简体   繁体   English

单击时jQuery Nav消失

[英]Jquery Nav disappears when clicked on

Working on some jquery nav tabs, 在一些jquery导航标签上工作,

The problem 问题

1) when click on a tab the main navigation disappears ! 1)单击选项卡时,主导航消失! Can anyone see why??? 谁能看到原因???

http://jsfiddle.net/w8e8y/ http://jsfiddle.net/w8e8y/

/*  TABS
===================================================================*/

$(".profile-tabs a").click(function (e) {
    e.preventDefault();
    idTab = $(this).attr("href");
    $(".profile-tabs .active").removeClass('active');
    $(this).addClass('active');
    $(idTab).siblings().stop().fadeOut(300, function () {
        setTimeout(function () {
            $(idTab).fadeIn(300);
        }, 300)
    })
    // $(idTab).show().siblings().hide();
})

Yes. 是。 You are hiding all its siblings including the uls . 您隐藏了包括uls在内的所有兄弟姐妹。 Instead use an attribute endswith selector or use a common classname for the content divs, Change it to : 而是使用属性endswith选择器或对内容div使用通用的classname ,将其更改为:

   $(idTab).siblings('div[id$=-tab]').stop().fadeOut(300, function () {
        setTimeout(function () {
            $(idTab).fadeIn(300);
        }, 300)
    });

from

$(idTab).siblings().stop().fadeOut(300, function () {
        setTimeout(function () {
            $(idTab).fadeIn(300);
        }, 300)
    })

Demo 演示版

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM