dkern / jquery.lazy

A lightweight, fast, feature-rich, powerful and highly configurable delayed content, image and background lazy loading plugin for jQuery & Zepto.
http://jquery.eisbehr.de/lazy
Other
1.02k stars 236 forks source link

Need to add alt attribute. #240

Closed palanivelayudam closed 2 years ago

palanivelayudam commented 4 years ago

Currently i was using the picture tag like this.. I need to add alt attribute for image tag which was generating inside the picture tag through lazy, how to add alt attribute or custom attribute to the image tag.?

palanivelayudam commented 4 years ago

And by the way i need to know another thing, If we add the alt tag to the image via script means is that Good for SEO.? Will crawler reads the image tag and alt attribute.?

palanivelayudam commented 4 years ago

Hai, Can any one help me on this issue for me.?

ttakanawa commented 3 years ago

Hello @palanivelayudam

I can answer your first question. Could you try like below?

<picture>
  <data-src srcset="1x.jpg 1x, 2x.jpg 2x, 3x.jpg 3x" media="(min-width: 600px)" type="image/jpeg"></data-src>
  <data-img src="default.jpg" alt="description of the image"></data-img>
</picture>

https://github.com/dkern/jquery.lazy/blob/master/plugins/README.md#picture-loader