Created
April 30, 2014 18:06
-
-
Save bretdavidson/4d58194f58b25abb84ae to your computer and use it in GitHub Desktop.
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
// Taken from: http://stackoverflow.com/a/9349999 | |
// <img data-other-src="big-zebra.jpg" src="small-zebra.jpg"> | |
// <img data-other-src="big-elephant.jpg" src="small-elephant.jpg"> | |
// <img data-other-src="big-bear.jpg" src="small-bear.jpg"> | |
$(function () { | |
$('img').on('mouseenter mouseleave', function () { | |
$(this).attr({ | |
src: $(this).attr('data-other-src'), | |
'data-other-src': $(this).attr('src') | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment