我正在寻找一种方法来更改切换时的背景图像,如下面的问题所示:
我的问题是我有这个html:
<button id="close-menu"></button>
<div id="menu-bar">
<div class="wrapper">
<a href="http://www.website.com" target="_blank">
<img src="image.png" alt="">
</a>
<div class="options">
<h2>eBlast Tools</h2>
<ul>
<li class="toggle-images">Images are <span>enabled</span>. Click to disable.</li>
<li class="download-zip"><a href="download.zip">Download ZIP File</a></li>
</ul>
</div>
</div>
</div>
这是我当前的 jquery:
$('#close-menu').click(function() {
$('#menu-bar').slideToggle(400);
return false;
});
这是CSS:
#close-menu {
background: url(../img/minus-button.png);
background-position: top left;
width: 25px;
height: 25px;
position: absolute;
top: 10px;
right: 20px;
z-index: 100;
border: none;
}
#close-menu:hover {
background: url(../img/minus-button.png);
background-position: bottom left;
}