यदि आप jQuery के साथ चयन करते हैं और छवि बनाते हैं और फिर उपयोग करते हैं .width()
, तो आपको छवियों को वर्तमान चौड़ाई मिलेगी, भले ही इसे स्केल किया गया हो (जैसे अधिकतम-चौड़ाई: 100%;)। आप छवियों को इस तरह से उपयोग कर सकते हैं (भले ही इसमें ऐसी कोई भी विशेषता न हो जो इसे घोषित करें):
// 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;