parent() 的问题
jQuery代码 http://webdev.faressoft.org/wp-content/plugins/ImageSlideShow/js/slideShow.js
你可以在这里看到结果(图片幻灯片) http://webdev.faressoft.org/?p=208
$(".ImageNum span").click(function() {
var image = parseInt($(this).text());
$(".correntImage", $(this).parent()).removeClass("correntImage");
$(this).addClass("correntImage");
$(this).parent().parent().children("img").css("display","none");
$(this).parent().parent().children("img").slice(image-1,image).css("display","block");
$(this).parent().parent().children(".autoSlideShow").text("false");
});
为什么当我点击 $(".ImageNum span") 时没有任何变化?
最佳答案
我认为问题可能在于使用 children()
多人使用parent()
.
$(this).parent().parent()
没有直达<img>
children ……有吗?
尝试替换 children()
通过 find()
;)
关于javascript - parent() 的问题 (jQuery),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3774921/