简体   繁体   中英

Check native browser support for lazy-loading images

I have a script that lazy-loads images, but since chrome 76 there is a 'native' lazy load.

I'm trying to detect whether browser supports native lazy-load or not. But I have no idea how to do this.

You can do this by using feature detection on an img element:

var supportsLazyLoad = ('loading' in document.createElement('img'));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM