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

后端 未结 5 1693
梦如初夏
梦如初夏 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:35

    I had this same problem as well. After some researching it seems that the browser needs to have a predefined value for the image in order to reset the size. So on the initial load, it messes up, but on reload the height of the image is retained, so then the javascript works correctly. You need to code in the initial height of your images so that the JS can resize them properly.

提交回复
热议问题