javascript - Changing image on hover -
i need menu consisting of images , images should change when hover around it.
html
<div id="menu" > <a href="#" id="home"><img src="images/about.png" alt="logo" /></a> </div> css
#menu { margin-left : 353px; margin-top : -70px; padding-bottom : 16px; } #home { background : transparent url(images/about.png); z-index : 1; } #home:hover { background : url(images/aboutr.png); z-index : 2; } the problem facing when hover around menu item, image displayed on hover displayed at of old image. moreover, hover background image displayed very small in width , height. please out. ![enter image description here][1]
as stated, no need js solution.
another of doing loading both images , hiding/showing them :hover event. this:
html:
<a id="home"><img class="image_on" src="images/about.png" alt="logo" /><img class="image_off" src="images/aboutr.png" alt="logo" /></a> css:
.. .image_off, #home:hover .image_on{ display:none } .image_on, #home:hover .image_off{ display:block } ..
Comments
Post a Comment