Check if images are loaded?

后端 未结 3 464
野趣味
野趣味 2020-11-27 07:36

I\'m looking for a sulotion that check if all images are loaded before they are used in a image slider/rotator. I was thinking of a solution that only show the buttons or th

3条回答
  •  借酒劲吻你
    2020-11-27 08:22

    Rather than checking if all images are loaded, why not create the slider/rotator using the $(window).load() event, rather than the usual $(document).ready()? $(window).load() waits for the page to finish loading, including resources such as images, before executing.

    See: window.onload vs. body.onload vs. document.onready (also on Stack Overflow).

提交回复
热议问题