开发者

Jquery to detect identical class and text for tab navi

Does anyone have experience detecting identical text(); and class?

here is my current code to

    $("ul.nav li").click(function() {

    $('ul.slideMove li').fadeOut('slow');

    var sharedata = $(this).text();
    $('ul.slideMove li[class = "'+sharedata+'" ]').fadeIn('slow');

});

the final goal will be to have tabbed navigation. When the text in ul.nav li is the same as a class within the the dynamic container, fadeIn(). On initial load, only one container will be visible then hide and show another container after you click the next li

If开发者_StackOverflow anyone can point me in the right direction i would really apprecieate it.

Currently, it hides all the containers after i click any li. Im not clear on how I can detect if the class equals the text var.

Thanks so much!


$('ul.slideMove li[class = "'+sharedata+'" ]').fadeIn('slow'); 

should be

$('ul.slideMove li.'+sharedata).fadeIn('slow');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜