How do I get actual image width and height using jQuery?

前端 未结 5 1034
情书的邮戳
情书的邮戳 2020-11-30 05:49

On a page I have displayed 100 images, which have the width and height attribute changed. Image id is in a loop.

How do I get the original image size, inside this

5条回答
  •  自闭症患者
    2020-11-30 06:45

    Try this one:

    $("")
                .attr("src", element.attr("src"))
                .load(function(){
                    MG.originalSize[0] = this.width;
                    MG.originalSize[1] = this.height;
    

    });

提交回复
热议问题