Little help with jQuery

Discussion in 'jQuery' started by HomeBlogger, Jun 7, 2011.

  1. #1
    Hi,

    I’m currently building some tabs in a template, and I’ve done that with jQuery. The codes that I’m currently using for showing the tabs content is:

        $(document).ready(function(){ $(”.email”).click(function(){ $(”.emailform”).toggle(“fast”); $(this).toggleClass(“active”); return false; }); });
    Code (markup):
    AND FOR THE SECOND TAB IS :


        $(document).ready(function(){ $(”.portfolio”).click(function(){ $(”.portfoliocontent”).toggle(“fast”); $(this).toggleClass(“active”); return false; }); }); 
    Code (markup):
    The problem is, if you open the first tab, and then you click the second one, the first one doesn’t close. I looking for some help that will make an opened tab closes once the other one opens.

    Thanks in advance
     
    HomeBlogger, Jun 7, 2011 IP
  2. darbetim

    darbetim Member

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #2
    $(document).ready(function(){ $(”.email”).click(function(){ $(”.emailform”).toggle(“fast”); $(this).toggleClass(“active”); $(".portfolio").toggleClass(“deactive”); return false; }); });

    $(document).ready(function(){ $(”.portfolio”).click(function(){ $(”.portfoliocontent”).toggle(“fast”); $(this).toggleClass(“active”); $(".email").toggleClass(“deactive”); return false; }); });
     
    darbetim, Jun 11, 2011 IP