2012-11-27 52 views
1

所有我有tiltes(標籤),我需要做到的是,當一個標籤式點擊我想要的顏色將變爲紅色或什麼意義是積極的,其餘的非有效選項卡TabContainer的保持黑色的默認顏色。我試圖在網上搜索,我看到的唯一的解決方案是用class .tabLabel {color:Red;}將所有標籤標題更改爲紅色的css也嘗試了onShow事件,它可以響應警報事件,但不響應樣式表。另外,如果你在tabcontainer中使用id,並使用dojo javascript來應用css,它會更改標籤中的內容而不是標題。這裏有一個示例代碼,我從dojo得到了我想要實現的東西。道場TabContainer的標題(標籤)

<!DOCTYPE html> 
<html > 
<head> 

    <link rel="stylesheet" href="../../_static/js/dojo/../dijit/themes/claro/claro.css"> 

<script>dojoConfig = {parseOnLoad: true}</script><script src='../../_static/js/dojo/dojo.js'></script><script>require(["dojo/parser", "dijit/layout/TabContainer", "dijit/layout/ContentPane"]);</script> 
</head> 
<body class="claro"> 
    <div style="width: 350px; height: 300px"> 
    <div data-dojo-type="dijit/layout/TabContainer" style="width: 100%; height: 100%;"> 
     <div data-dojo-type="dijit/layout/ContentPane" title="My first tab" data-dojo-props="selected:true"> 
      Lorem ipsum and all around... 
     </div> 
     <div data-dojo-type="dijit/layout/ContentPane" title="My second tab"> 
      Lorem ipsum and all around - second... 
     </div> 
     <div data-dojo-type="dijit/layout/ContentPane" title="My last tab" data-dojo-props="closable:true"> 
      Lorem ipsum and all around - last... 
     </div> 
    </div> 
</div> 
</body> 
</html> 

從上面的代碼中,我想使標題=「我的第一個選項卡」活動以不同顏色的文字和其他選項卡,在默認的顏色和我的第二個選項卡中單擊激活它,做同樣的行動作爲網站上的第一種菜單鏈接。 請幫忙。謝謝

回答

2

您可以通過添加此類來更改活動選項卡的文本顏色。

.dijitChecked.dijitTab .tabLabel { 
    color:red; 
} 

Here is an example.

+0

還要感謝我通過把標題的內容跨度那麼跨度,我能夠用昂秀事件中加入CSS類中的應用ID做到了。 – Bonnie