Check if an image is loaded (no errors) with jQuery

前端 未结 15 1566
挽巷
挽巷 2020-11-21 20:45

I\'m using JavaScript with the jQuery library to manipulate image thumbnails contained in a unordered list. When the image is loaded it does one thing, when an error occurs

15条回答
  •  没有蜡笔的小新
    2020-11-21 21:25

    Use imagesLoaded javascript library.

    Usable with plain Javascript and as a jQuery plugin.

    Features:

    • officially supported by IE8+
    • license: MIT
    • dependencies: none
    • weight (minified & gzipped) : 7kb minified (light!)

    Resources

    • Project on github: https://github.com/desandro/imagesloaded
    • Official website: http://imagesloaded.desandro.com/
    • https://stackoverflow.com/questions/26927575/why-use-imagesloaded-javascript-library-versus-jquerys-window-load
    • imagesloaded javascript library: what is the browser & device support?

提交回复
热议问题