Skip to content

Instantly share code, notes, and snippets.

@jalbertbowden
Created March 29, 2013 22:03
Embed
What would you like to do?
NaturalWidth and NaturalHeight in IE7 and IE8 via http://www.jacklmoore.com/notes/naturalwidth-and-naturalheight-in-ie/
function getNatural (DOMelement) {
var img = new Image();
img.src = DOMelement.src;
return {width: img.width, height: img.height};
}
var
natural = getNatural(document.getElementById('example')),
nWidth = natural.width,
nHeight = natural.height;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment