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

Add support for SVG and <image> tag #277

Open
hirasso opened this issue Aug 6, 2018 · 4 comments
Open

Add support for SVG and <image> tag #277

hirasso opened this issue Aug 6, 2018 · 4 comments

Comments

@hirasso
Copy link

hirasso commented Aug 6, 2018

Hi there, have been using this for ages, thanks so much! For a current project, I need to detect when images inside an SVG are loaded:

<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  <g>
    <image class="lazyload" xlink:href="./images/image-1.jpg" x="0" y="0" width="100%" height="100%" preserveAspectRatio="xMidYMid slice"></image>
  </g>
  <g clip-path="url(#ic__mask)">
    <image class="lazyload" xlink:href="./images/image-1.jpg" x="0" y="0" width="100%" height="100%" preserveAspectRatio="xMidYMid slice"></image>
  </g>
</svg>

...would be a very nice thing if you would add support for images with xlink:href in imagesloaded :)

@desandro
Copy link
Owner

desandro commented Aug 9, 2018

Thanks for this feature request.

Add a 👍 reaction to this issue if you would like to see this feature added. Do not add +1 comments — They will be deleted.

@hirasso
Copy link
Author

hirasso commented Aug 9, 2018

...seems like the upcoming SVG 2 standard is dropping the requirement for the xlink: prefix. So the solution would have to check for both xlink:href or href attributes.

I hope I'm not the only one needing this ;)

@neuropass
Copy link

@hirasso I gotta ask. Why would you have an img inside an SVG?

@hirasso
Copy link
Author

hirasso commented Oct 3, 2019

@neuropass https://ophelis.de/en/themen/akustik/ > scroll down a bit, the interactive image compare toy :)

It's just great for advanced masking of images.
https://developer.mozilla.org/en-US/docs/Web/SVG/Element/image

This was referenced Feb 9, 2022
Closed
@desandro desandro changed the title Support vor SVG image tag Add support for SVG Feb 9, 2022
@desandro desandro changed the title Add support for SVG Add support for SVG and <image> tag Feb 9, 2022
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

3 participants