Skip to content

Instantly share code, notes, and snippets.

@TyDraniu
Last active March 9, 2016 09:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TyDraniu/2aeb9fa8e5b87ed6d068 to your computer and use it in GitHub Desktop.
Save TyDraniu/2aeb9fa8e5b87ed6d068 to your computer and use it in GitHub Desktop.
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