Last post 1 hour 50 min ago
Posts last week 128
Average response time last week 28 min
All time posts 70381
All time tickets 10863
All time avg. posts per day 20

Helpdesk is open from Monday through Friday CET

Please create an (free) account to post any question in the support area.
Please check the development versions area. Look at the changelog, maybe your specific problem has been resolved already!
All tickets are private and they cannot be viewed by anyone. We have made public only a few tickets that we found helpful, after removing private information from them.

#6582 – wbAMP does not show images with lazy load js script

Posted in ‘Pre-sale questions’
This is a public ticket. Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.
Saturday, 16 March 2019 10:32 UTC
Floyd611
Hi everyone
in my website, created with joomla, I installed wbAMP plugin + jch optimize plugin.

In the "non-AMP" part of the site, I inserted the images as follows:

[code type="markup"]<img class = "b-lazy" src = date: image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
data-src = "/path/to/image.png" alt = "Description" />[/code]

The b-lazy class is associated with a javascript inserted in the index.php file of the template.

I didn't install any lazy load images plugins for Joomla!

When I view the AMP pages, the images are not displayed.

The images are seen only for the non-AMP site

Is there a solution?

Thank you so much
Saturday, 16 March 2019 10:42 UTC
Floyd611
I apologize for the message entered in the wrong section but I can't move the discussion to the Discuss wbAMP Community edition section
Monday, 18 March 2019 09:20 UTC
wb_weeblr
Hi

AMP does not allow any javascript so any form of lazy loading you implement in Joomla will not work on the AMP version of the page.

Best regards
 
Monday, 18 March 2019 10:25 UTC
Floyd611
Hi,
Thanks for the reply.

there is no solution?

Best regards
Monday, 18 March 2019 10:30 UTC
wb_weeblr
Hi

No direct solution. You must provide an alternative content for the AMP version of the page, using Hid/show tags in your content. See documentation here.

Best regards
 
Monday, 18 March 2019 10:42 UTC
Floyd611
Hi,
thanks a lot.
Best regards
Wednesday, 20 March 2019 17:04 UTC
Floyd611
Hi everyone
I did a test as suggested with hide/show tags in non-AMP pages and AMP pages.

In summary, I wrote this code in the Joomla editor:




{ wbamp-hide start }
< img class=" class-for-lazy-load-images " src = data : image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== data-src= "/ path/ to / img.jpg" alt="" width="" height="" />
{ wbamp-hide end }


{ wbamp-show start }
< img src= " /path/ to / img.jpg " alt="" width="" height="" />
{ wbamp-show end }




After clearing the cache, I updated the NON AMP pages and the AMP pages.


The article shows the images with the lazy-load script regularly in the NON AMP pages, and the images without any problems in the AMP pages.

Thanks you for your suggestion.
This ticket is closed, therefore read-only. You can no longer reply to it. If you need to provide more information, please open a new ticket and mention this ticket's number.