2

I have a website and customer want to optimize it a bit so, is there any easy ways to make it through MODX plugin or snippet?

I tried to do it manually but it always take a lot of time.

Found no ways in internet. How can I achieve this?

Chamila Maddumage
  • 3,304
  • 2
  • 32
  • 43
Mateech
  • 1,010
  • 1
  • 11
  • 26

1 Answers1

3

I have been facing the same issue until I have found a way to implement lazy loading to all iframes and images by:

  1. Changing src to data-src for images and non-youtube iframes
  2. Changing YouTube iframe to img and getting video thumbnail directly from YouTube

After that, I will initialize lazyload.js and execute some js.

You can find full example and the code in the repository MODX-lazy-loader-snippet

If you need any help, be free to comment on this answer and I will reply

Andrey Seregin
  • 315
  • 4
  • 6