lozad.js
lozad.js copied to clipboard
fix: call load on audio elements
👋
I'm currently building a media player library and about to release version 2. I added lozad.js
to provide lazy loading of media/iframe elements out of the box. I noticed that audio elements weren't loading because the load
method is not called on audio elements. This patch simply ensures we call the HTMLMediaElement.prototype.load
method on <audio>
elements.
@mihar-22 I'd love to merge this PR. Will be great if you can add details in README and an example in Demo page as well.
Thanks for getting back so quickly @ApoorvSaxena. I've added the examples but unfortunately it doesn't work at the moment. Everything seems right and the audio element is intersecting, the load method should be called but it isn't. Weirdly it logs the audio element right before calling load
but it never happens? Due to time I'll need to come back to this a bit later, apologies.