Skip to content

Instantly share code, notes, and snippets.

@davestacey
Last active August 29, 2015 13:56
Show Gist options
  • Save davestacey/8813092 to your computer and use it in GitHub Desktop.
Save davestacey/8813092 to your computer and use it in GitHub Desktop.
Hover Swap jpg
// Homepage rollover Functions
function imageHilight ($obj) {
var imagetochange = $obj.find('img');
imagetochange.attr('src', imagetochange.attr('src').replace(/\.jpg/, '-on.jpg') );
//console.log('imageHilight');
}
function imageUnHilight ($obj) {
var imagetochange = $obj.find('img');
imagetochange.attr('src', imagetochange.attr('src').replace(/\-on.jpg/, '.jpg') );
//console.log('imageUnHilight');
}
// Homepage rollover Functions
$( document ).ready(function() {
// Homepage rollover
$("li.views-fluid-grid-item").hover(function () {
imageHilight($(this));
}, function () {
imageUnHilight($(this));
});
});
@davestacey
Copy link
Author

When I need to swap jpegs on hover

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment