代码之家  ›  专栏  ›  技术社区  ›  faressoft

parent()(jquery)有问题

  •  0
  • faressoft  · 技术社区  · 14 年前

    父级()有问题

    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”)时没有任何变化?

    1 回复  |  直到 14 年前
        1
  •  3
  •   Golmote Kinoko    14 年前

    我认为问题可能在于 children() 不仅仅是使用 parent() .

    $(this).parent().parent() 没有直接 <img> 孩子们…是吗?

    尝试替换 儿童() 通过 find() ;)