【问题标题】:jquery first-child on a fadeIn fadeOut list doesn't workfadeIn 淡出列表上的 jquery first-child 不起作用
【发布时间】:2012-01-21 23:47:14
【问题描述】:

伙计们,我得到的这个列表没有打开另一个列表。

http://jsfiddle.net/mdamC/147/

我想显示第一个孩子,然后点击显示其他项目。

【问题讨论】:

    标签: jquery list bind fadein css-selectors


    【解决方案1】:

    试试这个小提琴http://jsfiddle.net/mdamC/149/

    $("ul#links li a").unbind().bind('click', function(e) {
        e.preventDefault();
        e.stopPropagation();
        $(this).toggleClass('active');
        $(".descriptions").fadeOut();
        //you must get the index of the parent <li> otherwise the index of the <a> is always 0!
        var index = $(this).parent().index();
    
        $(".descriptions").eq(index).fadeIn();
    
        $('.active').removeClass('active');
        $(this).addClass('active');
    
    }, function(e) {
        $(".descriptions").stop().fadeOut();
    });
    

    【讨论】:

    • 谢谢老兄,在我的本地版本中,所有的 div 都没有显示...!"!!
    • 尼古拉,你知道为什么吗? cos 无法在 jquery 7.1 上使用最新版本,有什么想法吗?
    • @DD77 他们改变了在 1.7 中处理事件的方式,试试这个:jsfiddle.net/mdamC/157
    【解决方案2】:

    你好修改了你的代码http://jsfiddle.net/mdamC/150/ Basicall 使用单击锚点的 href ,获取描述 div 并切换它。如果您正在寻找其他东西,请告诉我。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多