我有一套菜单可见
http://carbonyzed.co.uk/menu/2/
现在,当您单击MENU按钮时,UL 元素会打开,但我还需要将 menu.png 项目(按钮)更改为全宽版本,我们将调用 menu_open.png。
这是HTML代码
<div class="sidebar">
<a href="#" onclick="return showOrHide('menulink');"><div class="logo">TEST IMAGE</div></a>
<ul id="menulink">
<li>
<a href="#">Campaigns </a>
<ul class="submenu">
<li><a href="#">Sub Menu1</a></li>
<li><a href="#">Sub Menu2</a></li>
</ul>
</li>
<li>
<a href="#">Links </a>
<ul class="submenu">
<li><a href="#">Sub Menu1</a></li>
<li><a href="#">Sub Menu2</a></li>
</ul>
</li>
<li>
<a href="#">Media </a>
<ul class="submenu">
<li><a href="#">Sub Menu1</a></li>
<li><a href="#">Sub Menu2</a></li>
</ul>
</li>
<li><a href="#">History</a></li>
<li>
<a href="#">Messages </a>
<ul class="submenu">
<li><a href="#">Sub Menu1</a></li>
<li><a href="#">Sub Menu2</a></li>
</ul>
</li>
<li>
<a href="#">Maintenance </a>
<ul class="submenu">
<li><a href="#">Sub Menu1</a></li>
<li><a href="#">Sub Menu2</a></li>
</ul>
</li>
</ul>
</div>
这是依赖的CSS部分(或者我相信)
.logo {
display: block;
text-indent: -9999px;
text-transform: capitalize;
background: url(../images/menu.png) no-repeat;
height: 120px;
}
#menulink {
display: none;
}
.sidebar {
height: 100%;
min-height: 100%;
width: 213px;
/**CODE - background: url(../images/sidebarBg.png); - here**/
float: left;
position: absolute;
top: 0;
}
/** MENU **/
ul {
margin: 0;
padding: 0;
display: none;
list-style: none;
background: url(../images/sidebarBg.png);
}
ul li {
background: url(../images/listBg.png) bottom no-repeat;
text-indent: 50px;
}
ul li a {
color: white;
display: block;
text-decoration: none;
padding: 21px;
width: 170px;
text-shadow: 1px 1px 0 #191b20;
position:relative;
}
ul li:hover {
background: url(../images/listBgGreen.png) no-repeat;
}
ul li a:hover, ul li:hover a {
color: #FFF;
text-shadow: 1px 1px 0 #547829;
}
ul li a.dashboard {
background: url(../images/iconDashboard.png) 25px 50% no-repeat;
}
ul li a.pages {
background: url(../images/iconPages.png) 25px 50% no-repeat;
}
ul li a.media {
background: url(../images/iconMedia.png) 25px 50% no-repeat;
}
ul li a.history {
background: url(../images/iconHistory.png) 25px 50% no-repeat;
}
ul li a.messages {
background: url(../images/iconMessages.png) 25px 50% no-repeat;
}
ul li a.settings {
background: url(../images/iconSettings.png) 25px 50% no-repeat;
}
/** SUB MENU **/
ul li ul.submenu {
display: block;
z-index: 500;
top: 0;
}
ul li ul.submenu li {
background: url(../images/subMenuBg.png) bottom no-repeat;
}
ul li ul.submenu li a {
background: none;
padding: 13px;
width: 189px;
}
ul li ul.submenu li.last {
border-bottom: 1px solid #54575b;
background: url(../images/subMenuBg.png) top no-repeat;
}
ul li ul.submenu li.last a {
padding: 12px;
}
ul li:hover ul.submenu li a {
text-shadow: 1px 1px 0 black;
}
ul li ul.submenu li:hover {
background: url(../images/subMenuBgHover.png) bottom no-repeat;
}
/** PIPS **/
.pip {
display: block;
background: url(../images/pipBg.png);
padding: 3px 12px;
position: absolute;
top: 20px;
right: 25px;
color: white;
text-align: center;
text-indent: 0;
font-size: 10px;
border-top: 1px solid #1c1f23;
border-bottom: 1px solid #4c4f56;
border-radius: 30px;
-webkit-border-radius: 30px;
-moz-border-radius: 30px;
}
ul li:hover .pip {
background: url(../images/pipBgHover.png);
border-top: 1px solid #547829;
border-bottom: 1px solid #a4ce6b;
}
如果您还有任何问题或需要更多信息,请尽管提问。一如既往,非常感谢您的帮助。
亨利
JavaScript 元素
<script language="JavaScript">
function showOrHide(zap) {
if (document.getElementById) {
var abra = document.getElementById(zap).style;
if (abra.display == "block") {
abra.display = "none";
} else {
abra.display = "block";
}
return false;
} else {
return true;
}
}
</script>
我在哪里将宽度部分放入此代码中?谢谢 :D