2012-09-10 45 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);