替代nth-child为较旧的IE浏览器 [英] Alternative for nth-child for older IE browsers
本文介绍了替代nth-child为较旧的IE浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用 nth-child()
是否有针对旧版IE浏览器指定元素的替代方法?
Javascript (非jquery)也足够了。
编辑:给定额外的库不能添加到页面。
解决方案
您可以使用jQuery的:nth-child()选择器;
$(li:nth-child(even))//目标even li's
$ (li:nth-child(5n))//目标第五个li
Is there an alternative for targeting elements using nth-child()
for older IE browsers?
Javascript (non-jquery) would suffice as well.
EDIT: Given additional libraries cannot be added to the page.
解决方案
You can use jQuery's :nth-child() selector;
$("li:nth-child(even)") // target even li's
$("li:nth-child(odd)") // target odd li's
$("li:nth-child(5n)") // target the fifth li
这篇关于替代nth-child为较旧的IE浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文