Jquery tab navigation -
i have created row of tabbed links when clicked move show tab has been selected. when tab clicked current "up" tab returns "down" state , new selected tab changed "up".
it's simple process, works until last tab clicked, if click off doesn't return "down" position.
i have created js fiddle here:
my jquery follows:
$(function(){  $('a.tab-link-lower').click(function(){       var index_highest = 0;       // each of tabbed/folder links      $("a.tab-link-lower").each(function(x){            // remove styling tabs when tabbed folder clicked                          $('#tab'+x+'-lower a').css("color","#6c6a6a");            $('#tab'+x+'-lower').css("font-weight","normal").css("border-bottom","0px").css("background-image","url(http://s23.postimg.org/aunz2qnmf/folder_tab2.png)").css("margin-top","2px");              $('#tab'+$(this).attr("id")).css("display","none");       });       // add button/link decoration clicked tab folder when clicked      $('#'+$(this).attr("id")+'-lower').css("font-weight","bold").css("background-image","url(http://s23.postimg.org/aunz2qnmf/folder_tab2_up.png)").css("color","#ff0000").css("font-size","11px").css("margin-top","-3px").css("border-bottom","1px solid #090");       // change color of a:link once has been clicked      $('#tab'+$(this).attr("id")+' a').css("color","#000");  });   thanks,
alan.
problem element ids starting 1 id="tab1-lower" , after inside each() function using x parameter index starting 0. added variable called index incremented x inside each() function
see fiddle here http://jsfiddle.net/mypnz/2/
     // each of tabbed/folder links      $("a.tab-link-lower").each(function(x){           var index = x + 1;           // remove styling tabs when tabbed folder clicked                          $('#tab'+index+'-lower a').css("color","#6c6a6a");            $('#tab'+index+'-lower').css("font-weight","normal").css("border-bottom","0px").css("background-image","url(http://s23.postimg.org/aunz2qnmf/folder_tab2.png)").css("margin-top","2px");              $('#tab'+$(this).attr("id")).css("display","none");       });      
Comments
Post a Comment