Image does not have width at document.ready

后端 未结 3 1874
孤独总比滥情好
孤独总比滥情好 2020-12-21 15:02

I have a function that I wish to use to resize images:

http://jsfiddle.net/eUurB/

When I run it on document.ready, it has no effect; the image size returned

3条回答
  •  南笙
    南笙 (楼主)
    2020-12-21 15:14

    Images are not loaded at document.ready time. Instead use the .load() method of jQuery.

    $('#logo').load( function() {
        resizeImgByArea('logo', 500);
    });
    

提交回复
热议问题