Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 在更改样式时显示和隐藏内容_Jquery_Twitter Bootstrap - Fatal编程技术网

Jquery 在更改样式时显示和隐藏内容

Jquery 在更改样式时显示和隐藏内容,jquery,twitter-bootstrap,Jquery,Twitter Bootstrap,我有一个带有标签的导航栏。当点击某个选项卡时,该选项卡应处于活动状态,即css应更改。此外,应隐藏以前的内容并显示新内容,但我的行为与我希望的不同: 我做错了什么 因此需要一些代码这里是一些js: $(document).ready(function(){ $('.profileSubpage:gt(0)').hide(); $(document).on('click','ul.profileTabs li',function(e){ e.preventDef

我有一个带有标签的导航栏。当点击某个选项卡时,该选项卡应处于活动状态,即css应更改。此外,应隐藏以前的内容并显示新内容,但我的行为与我希望的不同:

我做错了什么

因此需要一些代码这里是一些js:

$(document).ready(function(){
    $('.profileSubpage:gt(0)').hide();
    $(document).on('click','ul.profileTabs li',function(e){
         e.preventDefault();
         var number = $(this).index();
         $(".profileSubpage").hide().eq((this).index()).show();
         $(this).addClass("active").siblings().removeClass("active");
    });
});

您的代码中有一个错误:

eq((this).index())
应该是:

eq($(this).index())

您的代码中有一个错误:

eq((this).index())
应该是:

eq($(this).index())

您的代码中有一个错误:

eq((this).index())
应该是:

eq($(this).index())

您的代码中有一个错误:

eq((this).index())
应该是:

eq($(this).index())

我已经修改了你的代码。检查

 $(document).on('click','ul.profileTabs li',function(e){
       e.preventDefault();
       var number = $(this).index(); 
       $(".profileSubpage").hide();
       $(".profileSubpage:eq("+number+")").show();
       $(this).addClass("active").siblings().removeClass("active");
 });    

我已经修改了你的代码。检查

 $(document).on('click','ul.profileTabs li',function(e){
       e.preventDefault();
       var number = $(this).index(); 
       $(".profileSubpage").hide();
       $(".profileSubpage:eq("+number+")").show();
       $(this).addClass("active").siblings().removeClass("active");
 });    

我已经修改了你的代码。检查

 $(document).on('click','ul.profileTabs li',function(e){
       e.preventDefault();
       var number = $(this).index(); 
       $(".profileSubpage").hide();
       $(".profileSubpage:eq("+number+")").show();
       $(this).addClass("active").siblings().removeClass("active");
 });    

我已经修改了你的代码。检查

 $(document).on('click','ul.profileTabs li',function(e){
       e.preventDefault();
       var number = $(this).index(); 
       $(".profileSubpage").hide();
       $(".profileSubpage:eq("+number+")").show();
       $(this).addClass("active").siblings().removeClass("active");
 });