Last active
November 5, 2015 04:03
-
-
Save gmemstr/16385a7e38d7f0f051dc to your computer and use it in GitHub Desktop.
Quick zoom on image hover
This file contains hidden or 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
/* | |
HoverZoom.js by Gabriel Simmer | |
Provides zoom-in on hover over element, | |
requires jQuery :) | |
Obviously you can change "img" to whatever | |
you'd like, e.g ".image" or "#image" | |
*/ | |
var imgHeight=720; | |
var imgWidth=1280; // Naturally you should replace these with your own values | |
$( document ).on({ | |
mouseenter:function() { | |
$("img").animate({ | |
"height": imgHeight, | |
"width": imgWidth | |
}); | |
}, | |
mouseleave:function(){ | |
$("img").animate({ | |
"height": "100%", | |
"width": "100%" | |
}) | |
}}, "img"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment