Last active
August 29, 2015 13:56
-
-
Save davestacey/8813092 to your computer and use it in GitHub Desktop.
Hover Swap jpg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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)); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When I need to swap jpegs on hover