Hi,
I'm having an issue with using fadeIn on some simple tab jQuery I've written.
I have a list of tabs which, when clicked, I want to fadeIn a div.
This works fine with a show / hide and for the most part with fadeIn. However, if I click on the tabs quickly in a row, it sporadically shows multiple divs. I presume that this is because the previous fadeIn has not completed before the next click occurs.
- //When page loads...
- $(".info").hide(); //Hide all content
- $("ul.tabs li:first a").addClass("active").show(); //Activate first tab
- $(".info:first").show(); //Show first tab content
- //On Click Event
- $("ul.tabs li a").click(function() {
- $("ul.tabs li a").removeClass("active"); //Remove any "active" class
- $(this).addClass("active"); //Add "active" class to selected tab
- var activeTab = $(this).attr("href"); //Find the href attribute value to identify the active tab + content
- $(".info").hide(); //Hide all tab content
- $(activeTab).fadeIn(5000); //Fade in the active ID content
- return false;
- });
Help!
Thanks,
Nick