javascript - Why $('a.current').removeClass('current'); is not working? -


why $('a.current').removeclass('current'); not working jquery tabs? http://jsfiddle.net/laukstein/ytnw9/8/

 //full js in http://jsfiddle.net/laukstein/ytnw9/8/  $(function(){  var list=$('#list'),      elementsperrow=-1,      loop=true,      // find first image y-offset find number of images per row      topoffset=list.find('a:eq(0)').offset().top,      numtabs=list.find('li').length-1,      current,newcurrent;   function changetab(diff){   // a.current set jquery tools tab plugin   $('li.current').removeclass('current');   current=list.find('a.current').parent('li').addclass('current').index();   newcurrent=(loop)?(current+diff+numtabs+1)%(numtabs+1):current+diff;  if(loop){    if(newcurrent>numtabs){newcurrent=0;}    if(newcurrent<0){newcurrent=numtabs;}  }else{    if(newcurrent>numtabs){newcurrent=numtabs;}    if(newcurrent<0){newcurrent=0;}  }   // don't trigger change if tab hasn't changed (for non-looping mode)  if (current!=newcurrent){    list.find('li').eq(current).removeclass('current');    list.find('li').eq(newcurrent).addclass('current').find('a').trigger('click'); // trigger click on tab  }  }  list   // set tabs   .tabs("#content",{effect:'ajax',history:true, xonbeforeclick:function(){changetab(0)}})   // find number of images on first row   .find('a').each(function(i){       if(elementsperrow<0&&$(this).offset().top>topoffset){          elementsperrow=i;       }   });  //$('a').filter('.current').parent('li').addclass('current'); // why not work?  //$('a.current').parent('li').addclass('current'); // why not work?   $('ul#list li').click(function(){$('li.current').removeclass('current');$(this).addclass('current')});  $('a.current').removeclass('current'); // why not work? }); 

html:

<ul id="list">     <li><a href="one.html" title="one">1</a></li>     <li><a href="two.html" title="two">2</a></li>     <li><a href="three.html" title="three">3</a></li> </ul> <div id="content"></div>​ 

as far can tell (i don't yet have working page running code), appears "current" class applied "li" elements.

i think $("a.current") contain 0 elements.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -