Skip to content

Instantly share code, notes, and snippets.

@TyDraniu TyDraniu/Zoom-img-in.js
Last active Mar 9, 2016

Embed
What would you like to do?
function zoomImage(image, amt) {
if (image.initialHeight == null) {
/* avoid accumulating integer-rounding error */
image.initialHeight=image.height;
image.initialWidth=image.width;
image.scalingFactor=1;
}
image.scalingFactor *= amt;
image.width = image.scalingFactor*image.initialWidth;
image.height = image.scalingFactor*image.initialHeight;
}
var i,L=document.images.length;
for (i=0;i<L;++i) zoomImage(document.images[i], 2);
if (!L) alert("This page contains no images.");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.