自己手写一个点击页面图片放大的效果。遇到获取原图尺寸问题
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