【发布时间】:2011-12-13 05:54:11
【问题描述】:
下面的代码只作用于最后一个子元素,它会触发所有其他子元素的函数。
$('.streetdog').hide();
$('.cat').mouseenter(function(){
var $catVal = $(".cat").index(this);
$('.streetdog:nth-child('+$catVal+')').show();
});
您可以在jsfiddle 上查看演示。
基本上我正在尝试触发特定循环的子元素并悬停.cat
【问题讨论】:
标签: jquery selector css-selectors