Skip to content

Can I change the size of img's default placeholder map (svg) #625

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

Open
JoJohw opened this issue Jan 8, 2025 · 5 comments
Open

Can I change the size of img's default placeholder map (svg) #625

JoJohw opened this issue Jan 8, 2025 · 5 comments

Comments

@JoJohw
Copy link

JoJohw commented Jan 8, 2025

<img alt="Mocassini" class="lazy" src="./placeholders/11-14.svg" data-src="./images/440x560-16.webp" width="220" height="280" />
Can I change the size of img's default placeholder (svg), because I placed a loading on src's default placeholder, which is too large

@verlok
Copy link
Owner

verlok commented Jan 8, 2025

I am not able to understand what you want to do, can you explain better what you have in the original DOM at page loading and what you want to do when vanilla-lazyload processes your image?

@JoJohw
Copy link
Author

JoJohw commented Jan 8, 2025

I am not able to understand what you want to do, can you explain better what you have in the original DOM at page loading and what you want to do when vanilla-lazyload processes your image?

This is my code
code

This is what my page looks like when it loads successfully(data-src)
loaded

This is what it looks like during the loading process(src)
loading

I expect to display this loading effect before the image is loaded, but currently it seems that this loading is very large. Is there any configuration that can change the image style of the placeholder src

This is my placeholder SVG
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="30px" viewBox="0 0 24 30" style="enable-background:new 0 0 50 50;" xml:space="preserve"> <rect x="0" y="0" width="4" height="10" fill="#ffffff"> <animateTransform attributeType="xml" attributeName="transform" type="translate" values="0 0; 0 20; 0 0" begin="0" dur="0.6s" repeatCount="indefinite"></animateTransform> </rect> <rect x="10" y="0" width="4" height="10" fill="#b2382d"> <animateTransform attributeType="xml" attributeName="transform" type="translate" values="0 0; 0 20; 0 0" begin="0.2s" dur="0.6s" repeatCount="indefinite"></animateTransform> </rect> <rect x="20" y="0" width="4" height="10" fill="#000000"> <animateTransform attributeType="xml" attributeName="transform" type="translate" values="0 0; 0 20; 0 0" begin="0.4s" dur="0.6s" repeatCount="indefinite"></animateTransform> </rect> </svg>

@JoJohw
Copy link
Author

JoJohw commented Jan 8, 2025

Or can the styles of placeholder src and data src be different?

@JoJohw
Copy link
Author

JoJohw commented Jan 8, 2025

shuan Q. i think i can use callback_loaded to change the class name when the img loaded

@verlok
Copy link
Owner

verlok commented Jan 9, 2025

Yes you can

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

No branches or pull requests

2 participants