03 Nov

imagefader

I was asked to write a simple image fader. I believe I’ve come up with possibly the simplest one out there.

demo

To use this in your own site, link your document to a copy of the javascript and run imagefader_init() upon load, then edit the <img> that you want to run the fader on – here is an example:

<img
  src="/i/test1.png"
  class="imagefader /i/test1.png /i/test2.png /i/test3.png"
/>

That’s it!

4 thoughts on “imagefader

  1. Looks good chap. The link to the javascript is broken – though I can grab it from the demo..

    cheers for that 🙂

    hostyle – If you are worried about the slashes you could replace them with some token and replace that when it comes time to use the class in the filepath

  2. thanks Mark. now that you’ve reminded me of it, I’ll upload the latest version (nothing major – just adds the current img src to the array so you don’t need to repeat it in the class). and I’ll fix that link. try again in five minutes.

Comments are closed.