【发布时间】:2011-12-01 11:50:55
【问题描述】:
我正在尝试修改此页面http://www.bluimage.it/dev/ 上的垂直选项卡的脚本,以便在选项卡的右侧放置一个箭头,因为我可以显示活动/选定的选项卡。我尝试调用一个 css 类,如图所示(注意“case”left:“):
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";
}
...它可以工作,但是当我转到其他选项卡时,在过去的选项卡中选择的选项仍然处于活动状态!如何停用其他的并仅在我所在的位置设置活动?
【问题讨论】:
标签: javascript jquery tabs customization