Fire an event after preloading images

前端 未结 10 1935
北海茫月
北海茫月 2020-12-25 15:25

This is the code I use to preload images, I\'m not sure if it\'s the best one. My question is, how can I fire and event, for an example alert(); dialog after is has finished

10条回答
  •  醉话见心
    2020-12-25 15:54

    As an alternative you could use a CSS technique to pre-load the images as shown here:

    http://perishablepress.com/press/2008/06/14/a-way-to-preload-images-without-javascript-that-is-so-much-better/

    and then use the global onLoad event which is fired when everything has been loaded

提交回复
热议问题