Keyword

data-src image attribute?

More
3 years 2 weeks ago #178529 by Rob
data-src image attribute? was created by Rob
I'm importing hundreds of articles into K2 and many of them use "data-src" attribute for the images. If I change the code to "img src" the images appear correctly. Am I missing something simple?

Many thanks in advance!

PHP 7.4
Joomla 3.9.25
Latest K2
 

Please Log in or Create an account to join the conversation.

More
3 years 2 weeks ago #178532 by JoomlaWorks
Replied by JoomlaWorks on topic data-src image attribute?
The site you're importing most likely used this script for lazy-loading images: afarkas.github.io/lazysizes/index.html

As such, images are referenced with a different attribute, instead of the "classic" src attribute.

So either install lazysizes.js (it's a good script by the way, but it won't beat the native loading="lazy" attribute in performance) or perform a database search/replace for data-src/src.

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

More
3 years 2 weeks ago #178533 by Rob
Replied by Rob on topic data-src image attribute?
Thank you very much for your quick reply!!

Please Log in or Create an account to join the conversation.

More
3 years 2 weeks ago #178555 by Rob
Replied by Rob on topic data-src image attribute?
Hi Fotis,
Do you have any recommendations where I can invoke this js from? I noticed a js folder in my template directory. (newsberg). How do I call this js script?
Thanks!

Please Log in or Create an account to join the conversation.

More
3 years 2 weeks ago #178564 by JoomlaWorks
Replied by JoomlaWorks on topic data-src image attribute?
Instructions are available here: afarkas.github.io/lazysizes/index.html

(hint: it's usually at the bottom of the document - just use a script tag)

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum