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

added dynamic svg placeholder #39

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

added dynamic svg placeholder #39

wants to merge 1 commit into from

Conversation

shakee93
Copy link

@shakee93 shakee93 commented May 9, 2020

adds support to dynamic svg/base64 datauri placeholder instead of the image placeholder. only if there is width and height attribute present in the img tag. this helps eliminate the reflow the jitter we get while lazy loading (cls : https://web.dev/cls/).

this pull doesn't break the default behaviour. it uses the default _placeholder_url only works when

add_filter('a3_lazy_load_svg_placeholder', function () {
	return true;
});

above filter is set to true.

@prathamesh-gharat
Copy link

@shakee93 - Thanks, this is a much needed feature in A3 Lazy load.

Note: Base64 encoding is not needed with SVG placeholders.

@MythThrazz
Copy link

Amazing idea, just realized that we have a huge CLS issue because of the default placeholder.gif doesn't respect the aspect ratio of the images. Tried it and it worked like a charm!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants