Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic image list #98

Open
chumanfu opened this issue Mar 1, 2021 · 2 comments · Fixed by #96
Open

Dynamic image list #98

chumanfu opened this issue Mar 1, 2021 · 2 comments · Fixed by #96
Assignees
Labels
enhancement New feature or request question Further information is requested
Milestone

Comments

@chumanfu
Copy link

chumanfu commented Mar 1, 2021

Hi.

Div which is hidden until the user click a button. I only load the images on the at the time I click the button.
This appears to cause the images not to render, I am guessing because the polyfill has already been performed on the images. Is there a way of progmatically calling the polyfill after the images are drawn in the div?

@mfranzke
Copy link
Owner

mfranzke commented Mar 4, 2021

@chumanfu thanks a lot for your request. I've just released a beta of the new version 2.0 that would provide this feature - you could install it via npm i loading-attribute-polyfill@beta
Than there's a public method that you might call with a query for each of the related DOM nodes, like e.g.:
loadingAttributePolyfill.prepareElement(document.querySelector('main noscript.loading-lazy'));

Do you have the chance to check this out regarding your usecase?

@mfranzke mfranzke added enhancement New feature or request question Further information is requested labels Mar 4, 2021
@mfranzke mfranzke added this to the 2.0 milestone Mar 4, 2021
@mfranzke mfranzke linked a pull request Mar 4, 2021 that will close this issue
@parto
Copy link

parto commented Feb 9, 2022

@mfranzke thanks for the polyfill. adding images dynamically seems to be broken. you can see this by visiting the demo url and clicking on the "Add dynamic image underneath" button while looking at the network tab. the dynamically added image is immediately downloaded without the need to scroll down. is there any workaround to fix this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants