Skip to content

Instantly share code, notes, and snippets.

@gmemstr
Last active November 5, 2015 04:03
Show Gist options
  • Save gmemstr/16385a7e38d7f0f051dc to your computer and use it in GitHub Desktop.
Save gmemstr/16385a7e38d7f0f051dc to your computer and use it in GitHub Desktop.
Quick zoom on image hover
/*
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