Monday, November 7, 2011

jQuery - Easy image rollover

[javascript]
$(".hover").hover( function() {
var currentImage = $(this).attr("src");
$(this).attr("src", $(this).attr("hover"));
$(this).attr("hover", currentImage);
//css("background-position", "-50px 0");
}, function() {
var currentImage = $(this).attr("src");
$(this).attr("src", $(this).attr("hover"));
$(this).attr("hover", currentImage);
});
[/javascript]

0 comments:

Post a Comment