Last active
December 24, 2015 03:59
-
-
Save oliverbenns/6740630 to your computer and use it in GitHub Desktop.
Nth-of-type IE7 & IE8 Fallback [jQuery]
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
<!--[if lt IE 7]> <html class="ie ie6 lte9 lte8 lte7"> <![endif]--> | |
<!--[if IE 7]> <html class="ie ie7 lte9 lte8 lte7"> <![endif]--> | |
<!--[if IE 8]> <html class="ie ie8 lte9 lte8"> <![endif]--> | |
<!--[if !IE]><!--> <html><!--<![endif]--> |
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
// Adds class 'l-end-col' to matched elements. | |
function nthFallback(ele, nth) { | |
if ($('html').hasClass('lte8')) { | |
$(ele + ':nth-of-type(' + nth + ')').addClass('l-end-col'); | |
} | |
} | |
// To run - e.g. select every 4th <li> | |
nthFallback('ul li','4n+4'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment