GoogleChromeLabs / wp-native-lazyload

WordPress plugin to lazy-load media using the native browser feature.
https://wordpress.org/plugins/native-lazyload/
Apache License 2.0
51 stars 13 forks source link

Add initial image load in older browser #16

Closed Soean closed 4 years ago

Soean commented 4 years ago

Summary

Older browsers like the IE 11 don't support IntersectionObserver, so they use the lazyLoad JS function. This function is only executed on scroll, resize and orientationchange event. This PR adds an initial function call, to load the images in the viewport. We don't need to add a DOMContentLoaded listener, because the script is appended after this event.

Adresses issue #5