-
My name is Brad Harris, and I currently reside in the Abq, New Mexico area. I'm a web-developer, specializing in front-end development. PHP is my weapon of choice for the server side, but my creative side thrives on Javascript and CSS.
-
My Recent Ramblings
Tags
Archives
Monthly Archives: March 2008
Simple jQuery image rollover script
Just a simple script I use to automate image rollovers that may be of use to others. Just include this javascript:
$(function() {
$('.rollover').hover(function() {
var currentImg = $(this).attr('src');
$(this).attr('src', $(this).attr('hover'));
$(this).attr('hover', currentImg);
}, function() {
var currentImg = $(this).attr('src');
$(this).attr('src', $(this).attr('hover'));
$(this).attr('hover', currentImg);
});
});
This will pick up an image that looks as follows, and setup the rollover image:
<img src="first.gif" hover="second.gif" class="rollover"/>
Tagged javascript, jquery 31 Comments
Slikcalc – Easy Javascript Calculations