javascript - Switch between two images in html with css -


i'm working on wordpress theme , want switch between 2 thumbnail images on hover.

the code have looks :

<a class="thumb" href="posturl"> <img src="img1.jpg" class="image1" /> <img src="img2.jpg" class="image2" /> </a> 

so need css change between image1 , image2 on hover.

and if knows how can fade effect javascript appreciated.

first, want rid of img tags , use css:

a:link { background: url("img1.jpg"); } a:hover { background: url("img2.jpg"); } 

you use javascript complicated, css3 have fade effects ready soon:

a:link { background: url("img1.jpg"); -webkit-transition:background 1s ease-in;   -moz-transition:background 1s ease-in;   -o-transition:background 1s ease-in;   transition:background 1s ease-in;   } a:hover { background: url("img2.jpg"); } 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -