jquery .load() doesn't work after hard refresh

后端 未结 5 1742
梦如初夏
梦如初夏 2021-01-16 19:03

I have some code that when the page loads gets the height of an image and then resizes its container div accordingly. This works fine unless its the first time the page has

5条回答
  •  孤独总比滥情好
    2021-01-16 19:34

    Try calling your code in $(window).load. This will run after all images have loaded.

    $(window).load(function () {
       // run code
    });
    

    Or you could try the imgload plugin.

提交回复
热议问题