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

Remove the lazyload data attribute after the image has been loaded #326

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

artifex404
Copy link

By removing the lazyload data attribute after loading the image we can select those image with a CSS selector :not([data-original]).

This is especially useful when images are flexible (width: 100%, height: auto).

Currently there is a bug if the images are of flexible width with height set to auto. When the base64 encoded placeholder is placed, the height: auto makes the height the same amount as width, because it's a 1 per 1 pixel image. That makes the page jump when you scroll the page down to top (try to scroll down on a page, and then hit refresh).

With this feature, we can apply the height: auto only to "loaded" images and that will fix this issue.

@tuupola tuupola added the 2.x label Aug 29, 2017
@tuupola tuupola self-assigned this Aug 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants