Jquery 里的节点遍历(next(),perv(),nextAll(),prevAll())
$(this).next().size();//下一个兄弟元素
$(this).nextAll().size()//下面所有的兄弟元素
$(this).prev().size();//上面的第一个兄弟元素
$(this).prevAll().size();//上面的所有的兄弟元素
$(this).siblings().size();//全部兄弟元素
:nth-child表示匹配其下的子元素
jQuery动态缩放焦点图代码DEMO js代码
<script>
$(".small_pic li").mouseover(function(){
$(this).addClass("on").siblings().removeClass("on");
//$(this).addClass("on");
var preNumber=$(this).prevAll().size()+1;
$(".big_pic li").removeClass("on");
$(".big_pic li:nth-child("+preNumber+")").addClass("on");
});
</script>