Notes by James

Displaying notes 1 - 10
Created by James on April 11, 2015 12:41:12    Last update: April 11, 2015 12:41:24
This didn't work in the Android browser (but worked in Firefox under Android): .hero { background: url(images/bg.jpg) no-... This worked: .hero { background: url(images/bg.j...
Created by James on September 09, 2014 16:51:22    Last update: September 09, 2014 16:51:22
This Mozilla page gives a good explanation of the CSS background shorthand: https://developer.mozilla.org/en-US/docs/Web/CSS/background Example: background: url('../img/google-play.png') no-repea...
Created by James on September 04, 2014 21:52:29    Last update: September 04, 2014 21:52:29
To select jQuery objects with both class the-class and name the-name : $(".the-class [name=the-name] ")
Created by James on September 02, 2014 15:42:09    Last update: September 02, 2014 15:42:34
Use a filter function to get text nodes within a jQuery object: $('#users-table tr:eq(1) td:eq(1)') .conten...
Created by James on September 02, 2014 13:36:25    Last update: September 02, 2014 13:36:25
Use the :last-child selector. Example: $('#users-table tr:gt(0)').each(function() { ...
Created by James on August 08, 2014 12:17:50    Last update: August 08, 2014 12:17:50
Simple answer: use $(elem).css('margin-top') , $(elem).css('padding-left') , etc., don't use $(elem).css('margin') or $(elem).css('padding') , they return empty strings. Example: // set margin to 8px $('#test-div').css('margin...
Created by James on August 06, 2014 16:11:23    Last update: August 06, 2014 16:11:23
Select all <li> that are descendants (children, grand children etc.) of <ul> : ul li { margin: 0 0 5px 0; } Select all <li> that are direct children of <ul> : ul > li { margin: 0 0 5px 0; } Select all <p> that immediately follow another <p> : p + p { font-size: smaller; } Select a <ul> that immediately follows an element with id " title ": #title + ul { margin-top: 0; } Select all <p> that follow another </p> , not necessarily immediate sibling: p ~ p { font-size: smaller; }
Created by James on August 05, 2014 13:35:05    Last update: August 05, 2014 13:36:15
This demo page shows how to fade text in the end of an abstract with a "Learn more..." link to the full text. This technique could be helpful when you want to display an RSS feed abstract in a fixed height element and provide a link to the full-length article at the bottom. <html> <head> <title>Learn More</title> <...
Created by James on July 29, 2014 10:09:55    Last update: July 29, 2014 10:09:55
To sort a selected list of divs by vertical position: $('div.container').sort(function(a, b) { return $(...
Created by James on June 17, 2014 16:27:29    Last update: June 17, 2014 16:27:29
With built-in Array.concat : // initialize a1 a1 = [1, 2, 3] // i... With jQuery merge : // initialize a1 a1 = [1, 2, 3] // i...
Previous  1 2 3 4 5 6 7 8 9 10 Next