单击此按钮时
<div id="header-nav-container">
<div id="explore" class="btn btn-clear header-nav">
<a title="Explore">Explore </a>
</div>
我希望打开此菜单,然后单击agin关闭,如切换
<div id="header-menus">
<div id="explore-menu" class="header-menu open">
最佳答案
尝试这个:
<a title="Explore" onclick="toggleOpen();">Explore </a>
function toggleOpen(){
if (document.getElementById("explore-menu").className == "header-menu") {
document.getElementById("explore-menu").className = "header-menu open";
}
else {
document.getElementById("explore-menu").className = "header-menu";
}
}