Keyword

data-src image attribute?

More
2 weeks 1 day 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.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
2 weeks 1 day ago #178532 by Fotis
Replied by Fotis 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.

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

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

More
2 weeks 1 day 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
1 week 6 days 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.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
1 week 6 days ago #178564 by Fotis
Replied by Fotis 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)

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

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


Powered by Kunena Forum