Highlight ListView selected row

Other solution (mostly in XML) 1) set the choiceMode of the ListView to singleChoice <ListView android:choiceMode=”singleChoice” …/> 2) Items of the list must be a Checkable View and use a Color State List as Background eg: album_item.xml <?xml version=”1.0″ encoding=”utf-8″?> <CheckedTextView xmlns:android=”http://schemas.android.com/apk/res/android” android:background=”@drawable/list_selector” …/> 3) the background Color State (list_selector.xml) defines the highlight color <?xml … Read more

How do you make an element “flash” in jQuery

My way is .fadein, .fadeout .fadein, .fadeout …… $(“#someElement”).fadeOut(100).fadeIn(100).fadeOut(100).fadeIn(100); function go1() { $(“#demo1″).fadeOut(100).fadeIn(100).fadeOut(100).fadeIn(100)} function go2() { $(‘#demo2’).delay(100).fadeOut().fadeIn(‘slow’) } #demo1, #demo2 { text-align: center; font-family: Helvetica; background: IndianRed; height: 50px; line-height: 50px; width: 150px; } <script src=”https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js”></script> <button onclick=”go1()”>Click Me</button> <div id=’demo1′>My Element</div> <br> <button onclick=”go2()”>Click Me</button> (from comment) <div id=’demo2′>My Element</div>

Showing C# tags in Jekyll Github pages using Highlight.js

Jekyll has highlight tag and css (_sass/_syntax-highlighting.scss) onboard. {% highlight csharp %} /// <summary> /// Main class of the project /// </summary> class Program { /// <summary> /// Main entry point of the program /// </summary> /// <param name=”args”>Command line args</param> static void Main(string[] args) { //Do stuff } } {% endhighlight %} This works … Read more

Javascript: How to detect if a word is highlighted

The easiest way to do this is to detect mouseup and keyup events on the document and check whether any text is selected. The following will work in all major browsers. Example: http://www.jsfiddle.net/timdown/SW54T/ function getSelectedText() { var text = “”; if (typeof window.getSelection != “undefined”) { text = window.getSelection().toString(); } else if (typeof document.selection != … Read more

Select a complete table with Javascript (to be copied to clipboard)

Yes. It’s not too tricky, and the following will work in all mainstream browsers (including IE 6, and indeed 5): (Updated 7 September 2012 after Jukka Korpela’s comment pointing out that the previous version didn’t work in IE 9 standards mode) Demo: http://jsfiddle.net/timdown/hGkGp/749/ Code: function selectElementContents(el) { var body = document.body, range, sel; if (document.createRange … Read more