Created
June 8, 2013 02:35
-
-
Save SaraSoueidan/5733732 to your computer and use it in GitHub Desktop.
DOM Query (select all elements in a list under a condition)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*select all elements in a given list on elements as soon or as long as this lists contains | |
at least a certain number of elements*/ | |
/*useful when we need to start changing styles of elements when they start getting crowded | |
after a certain number*/ | |
/*for more explanation: http://vimeo.com/31719130 (lea verou's talk)*/ | |
/*Supported in all major moder browsers, and IE >= 9 */ | |
#palette > li:first-child:nth-last-child(n+3) span, /*like media query for the dom, now it checks if | |
it has at leat 3 elements, and selects the span, in other words, select the span in all | |
the elements of the list as soon as this list's items exceed 3*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment