Image rollovers in WordPress posts?
Not the most obvious thing to have in blog posts, but rollovers can be nice to have on static pages – especially if you use WordPress to build full web sites.
I would’ve thought someone had already done a plugin for this, but was not able to find one. So this afternoon I threw one together. All the plugin does is to load a javascript I got from
peps.ca/blog/easy-image-rollover-script-with-jquery/
Download: JRoll WordPress plugin
Installation: just unzip jroll.zip in your plugins folder.
Usage: For a given image file, e.g. “image.jpg”, the corresponding rollover image file must be named “image_o.jpg”.
Then you add class=”ro” in your image code, like:
<img src="image.jpg" class="ro" />
<input type="image" src="image.jpg" class="ro" />
Caveats:
- For some reason, WP seems to delete the
class
tags, so I had to edit the posts directly in the database. - You must use a recent version of jquery. The one that ships with WordPress (currently 1.1.4) does not work. I had to replace it with version 1.2.3. That is, I downloaded jquery from jquery.com/ and replaced /var/www/html/wordpress-mu-1.3.3/wp-includes/js/jquery/jquery.js with the downloaded jquery script.
Thanks for the post, I have been having the same problems.
Hi – Interested in using this on my site at the link above – the button on the page. Does this work with wordpress 2.7? If so, I downloaded the latest jquery, wondering where to install on a self-hosted wordpress site.
Thank you for developing this – I hope I can get it to work.