Paul Designer
Paul Designer

Reputation: 865

Jquery Nav disappears when clicked on

Working on some jquery nav tabs,

The problem

1) when click on a tab the main navigation disappears ! Can anyone see why???

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();
})

Upvotes: 0

Views: 61

Answers (1)

PSL
PSL

Reputation: 123739

Yes. You are hiding all its siblings including the uls. Instead use an attribute endswith selector or use a common classname for the content divs, Change it to :

   $(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

Upvotes: 1

Related Questions