0
我試圖修改此頁面上的垂直製表符的腳本http://www.bluimage.it/dev/將箭頭放在選項卡的右側,因爲我可以顯示活動/選定的一個。我嘗試調用一個CSS類如圖所示(請注意「案例‘左’):自定義活動選項卡與jquery/javascript
function showContentDesc(modid, ind, pos)
{
i = 0;
switch(pos)
{
case "top":
thisstyle=document.getElementById("menu_" + modid + "_" + ind).style.borderBottom;
while (document.getElementById("content_" + modid + "_" + i) != null) {
document.getElementById("content_" + modid + "_" + i).style.display = "none";
document.getElementById("menu_" + modid + "_" + i).style.borderBottom = thisstyle;
i++;
}
document.getElementById("menu_" + modid + "_" + ind).style.borderBottom = "none";
break;
case "bottom":
thisstyle=document.getElementById("menu_" + modid + "_" + ind).style.borderTop;
while (document.getElementById("content_" + modid + "_" + i) != null) {
document.getElementById("content_" + modid + "_" + i).style.display = "none";
document.getElementById("menu_" + modid + "_" + i).style.borderTop = thisstyle;
i++;
}
document.getElementById("menu_" + modid + "_" + ind).style.borderTop = "none";
break;
case "right":
thisstyle=document.getElementById("menu_" + modid + "_" + ind).style.borderLeft;
while (document.getElementById("content_" + modid + "_" + i) != null) {
document.getElementById("content_" + modid + "_" + i).style.display = "none";
document.getElementById("menu_" + modid + "_" + i).style.borderLeft = thisstyle;
i++;
}
document.getElementById("menu_" + modid + "_" + ind).style.borderLeft = "none";
break;
case "left":
default:
thisstyle=document.getElementById("menu_" + modid + "_" + ind).style.borderRight;
while (document.getElementById("content_" + modid + "_" + i) != null) {
document.getElementById("content_" + modid + "_" + i).style.display = "none";
document.getElementById("menu_" + modid + "_" + i).style.borderRight = thisstyle;
i++;
}
document.getElementById("menu_" + modid + "_" + ind).className = "sliptabs-left-menuitem-container-active";
break;
}
document.getElementById("content_" + modid + "_" + ind).style.display = "inline";
}
...和它的作品,但是當我去其他標籤在過去的選項卡中選擇保持actived如何!我停用其他的和設置活動只在其中我?
爲什麼不只是removeClass()和addClass()類? (「ul.menu li」)。click(function(){(this).siblings(「selected」)。removeClass(「selected」); $(this).addClass(「selected」) ; }); 也$(「li.selected」)也會影響其他人。 – Stefan
@Stefan:感謝您的評論!我更新了片段。 – kubetz
謝謝dzejkej和Stefan!我嘗試把這個腳本放在我自己的文件夾中,用「ul.mymenuclass li」改變「ul.menu li」,但仍然不起作用......也許我不明白我必須把它放在哪裏? 我把你的劇本放在「break」後面......這是錯的嗎?抱歉,但我是一個新手! –