GoogleChromeLabs / wp-native-lazyload

WordPress plugin to lazy-load media using the native browser feature.
https://wordpress.org/plugins/native-lazyload/
Apache License 2.0
51 stars 13 forks source link

Do not lazy-load images in sliders #3

Open felixarntz opened 5 years ago

felixarntz commented 5 years ago

Issue Overview

Images in sliders being transformed is the most common source of issues with this plugin. Therefore, such images should be skipped.

Possible Solution

It is impossible to reliably know for the plugin whether an image appears in a slider. However, some of the most popular sliders in the WordPress ecosystem could be supported by blacklisting CSS classes they add, so that these images wouldn't be transformed.

Related support requests:

swissspidy commented 5 years ago

In AMP one can set the data-amp-auto-lightbox-disable attribute on an element and no lightbox will be added to its children.

Perhaps a similar functionality could be added here? If an element has a data-no-lazy-loading class, the feature would be disabled for all its children.

The big difference is that this gives the responsibility to the developers rather than this plugin.

ericvalois commented 5 years ago

Well, the skip-lazy css class is useful, but it's difficult to implement in the new WordPress editor. By default, the class is added to the parent <figure> element. https://cl.ly/4ecc15bc0e27

Most slider plugin allow to add a custom class to the wrapper. So, I think it would solve many issues if children of the skip-lazy class are excluded as well.

mbaierl commented 5 years ago

I just had the same issue with the Revolution Slider... the background image was not loaded at all... so I had to disable the lazy load plugin.