jQuery callback on image load (even when the image is cached)

前端 未结 14 1225
轻奢々
轻奢々 2020-11-21 06:25

I want to do:

$(\"img\").bind(\'load\', function() {
  // do stuff
});

But the load event doesn\'t fire when the image is loaded from cache

14条回答
  •  忘掉有多难
    2020-11-21 07:17

    I can give you a little tip if you want do like this:

    If you do that when the browser caches pictures, it's no problem always img shown but loading img under real picture.

提交回复
热议问题