jQuery wait till AJAX page is fully loaded

喜夏-厌秋 提交于 2019-11-29 05:22:23

You'll have to use direct event binding:

$("body img").on("load", function () { });
$("body .image-class").on("load", function () { });

Rather than delegated binding:

$("body").on("load", "img", function() { });
$("body").on("load", ".image-class", function () { });

Delegated bindings depend on the event bubbling, which not every event does. And it seems the "load" event -- at least, from an <img> -- is one that doesn't.

Example: http://jsfiddle.net/DLy6j/

In case of images you need to catch onload event for all the images. So once you get success callback, find all the images, add "onload" event, and calculate once all the images have been loaded.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!