Jquery来检测tab navi的相同类和文本 [英] Jquery to detect identical class and text for tab navi

查看:95
本文介绍了Jquery来检测tab navi的相同类和文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都有检测相同的文本()的经验;和类?

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

这里是我当前的代码

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

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

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

});

最终目标是具有标签式导航。当ul.nav li中的文本与动态容器中的类相同时,fadeIn()。在初始加载时,只有一个容器将可见,然后在您单击下一个li后隐藏并显示另一个容器

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 anyone can point me in the right direction i would really apprecieate it.

目前,它在我点击任何li后隐藏所有的容器。我不清楚如何检测类是否等于文本var。

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.

非常感谢!

解决方案

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

应为

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

这篇关于Jquery来检测tab navi的相同类和文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆