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

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -