/ Published in: JavaScript

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// Get on screen image var screenImage = $("#image"); // Create new offscreen image to test var theImage = new Image(); theImage.src = screenImage.attr("src"); // Get accurate measurements from that. var imageWidth = theImage.width; var imageHeight = theImage.height;
URL: http://css-tricks.com/snippets/jquery/get-an-images-native-width/
Comments
