Image native width in jquery

后端 未结 4 1199
广开言路
广开言路 2021-01-21 02:58

With jQuery, i change the src of an image on click

$(\"#thumb li img\").click(function() {
var newlinkimage = $(this).attr(\"src\");

newlinkimage = newlinkimage         


        
4条回答
  •  隐瞒了意图╮
    2021-01-21 03:44

    This is the plain javascript way to do it. It should be easy to integrate this into your code.

    var newimage = new Image();
    newimage.src = 'retouche-hr' + newlinkimage + '-a.jpg'; // path to image
    var width = newimage.width;
    var height = newimage.height;
    

提交回复
热议问题