Last active
February 15, 2019 03:42
-
-
Save shawn-crigger/1f9ed8296dcb1862bb90 to your computer and use it in GitHub Desktop.
Quick and dirty image roll over
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
<img src="http://nonhover.jpg" alt="" class="roll-over" data-roll-over="http://hover.jpg" /> | |
<script> | |
jQuery( "img.roll-over" ).hover( function() { | |
var old = $(this).attr('src'); | |
var roll = $(this).data('roll-over'); | |
$(this).attr('src', roll).data('roll-over', old); | |
}, function() { | |
var old = $(this).attr('src'); | |
var roll = $(this).data('roll-over'); | |
$(this).attr('src', roll).data('roll-over', old); | |
} | |
); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment