Search code examples
javascriptfaderollover

Adding a fade transition to Daniel Nolan's img rollover javascript


Ok I have realized that there is a ton of stuff about fading images with javascript, but none of them do what I would like.

Daniel Nolan's DOES.

His script allows me to simply add class=imgover to an image, and the result is a nice image swap. All I have to do is make the second image and add _o at the end of the filename. This is the best and simplest way I've seen. I don't need fancy jQuery transitions and I don't want to add extra markup in my css by adding background images. All I want is a nice fade transition between the images. Trust me I've looked at several jQuery tuts on image swaps.

All of the jQuery tuts I've seen require extra markup per image. I have several images on my page that will need the image swap. Most tuts online assume you only need one image on the page that needs the effect.

How can I add a fade transition to Daniel Nolan's img rollover javascript? I'd like to do that if possible, but I can't seem to get it working.

http://www.dnolan.com/code/js/rollover/

Raw Code


Solution

  • This is the best way:

    A better implementation of a fading image swap with javascript / jQuery

    It has the same premise of Daniel Nolan's script but it has a fade and it's jQuery.