2012-09-10 44 views
1

我们在页面的中间列使用五个标签来显示/隐藏内容。使用jQuery标签来显示隐藏额外内容

在我们的右栏中,只有选中选项卡1(这是页面加载时的默认值,名为'#overview')时才会出现内容。

如何确保当选项卡2,3,4或5被选中时,这个右边的div被设置为display:none?不幸的是,我不能在标签1的内容中包含这个简单的解决方案 - 它必须显示在右栏中。

我想隐藏的类是“kis-widget”(当#overview被选中),我们的显示/隐藏代码:

$(document).ready(function() 
    { 
     if (window.location.hash) 
     { 
     show(window.location.hash); 
     } 
     else 
     { 
     show('#overview'); 
     } 
    }); 

    function show(id) 
    { 
     $('#overview_div, #coursecontent_div, #profiles_div, #requirements_div, #fees_div').hide(); 
     $('#tabs li a').removeClass("selected"); 
     $(id + '_div').show(); 
     $(id + '_link').addClass("selected"); 
    } 

希望得到任何帮助。

由于

尼尔

回答

0

我怎样才能确保当突片2,3,4或5被选择时,这 右手格被设置为显示:无?

沿此线:

DOM: 
    TAB 1 .tab .tab-first 
    TAB 2 .tab 
    TAB 3 .tab 
    TAB 4 .tab 
    TAB 5 .tab 

代码如下:

function hiderighthanddiv(evt) 
{ 
//whatever you want 
} 

function showrighthanddiv(evt) 
{ 
//whatever you want 
} 

$('.tab').not('.tab-first').bind('click',hiderighthanddiv); 

$('.tab-first').bind('click',showrighthanddiv);