MadeByMike / supermaya

Home Page:https://supermaya-demo.netlify.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lazy loading images with title sets src to null

httpsterio opened this issue · comments

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.

commented

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