自己手寫一個點擊頁面圖片放大的效果。遇到獲取原圖尺寸問題
var img = $("#img_id"); var pic_real_width, pic_real_height; $("<img/>") .attr("src", $(img).attr("src")) .load(function() { pic_real_width = this.width; // Note: $(this).width() will not pic_real_height = this.height; // work for in memory images. });
轉載地址 http://www.webhek.com/post/get-real-image-width-and-height-with-javascript.html