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

Lazy loading images with title sets src to null #32

Open
httpsterio opened this issue May 31, 2020 · 1 comment
Open

Lazy loading images with title sets src to null #32

httpsterio opened this issue May 31, 2020 · 1 comment

Comments

@httpsterio
Copy link
Contributor

httpsterio commented May 31, 2020

I haven't tested this super extensively, but my parse-transform.js and main.js is identical to the one in this repo and I think I found a bug. I might just be a huge noob and if so, please disregard this.

If you create an image with both a src and a title, it'll get wrapped in a figure as per line 16 in parse-transform.js. But as it also gets processed by main.js line 14, ultimately the image src gets set to null and no image is shown. If an image has a title, it'll only show if you manually set the data-src to the image path as the data-src is used to set the src in main.js when lazyloading the images.

If a user uses a CMS, like Netlify CMS to manage the content they'll need to manually write image paths instead of using a WYSIWYG editor, so I think it would be better to read the src attribute instead and set the data-src based on that.

@MadeByMike
Copy link
Owner

Yep this is a bug! Super late reply sorry! I'll try to find some time to fix this 👍

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

No branches or pull requests

2 participants