Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to prevent the js side of the script to process excluded images #43

Closed
thomasmery opened this issue Apr 10, 2018 · 2 comments
Assignees

Comments

@thomasmery
Copy link

Hi,

at the moment it seems like all images and iFrames are processed by the js script even though there is the possibility to exclude images from being prepared by the php side of things

this results in excluded image still getting the lazyloading class and data-was-processed attribute whereas they have been excluded from the processing.

Is it a known issue or by design?

I have started to add a filter on the elements_selector option of the hard coded lazyLoadOptions in /rocket-lazy-load.php like it's been done for $threshold

this seems to be working as intended with adding a filter like

add_filter(
  'rocket_lazyload_elements_selector',
  function () { return "img:not([data-no-lazy]"; }
);

for instance

any input on this would be great

thanks

@thomasmery
Copy link
Author

I started to add a generic mechanism to exclude the same elements that are excluded from the preparation for the js script

this work has been done here: https://github.com/aaltomeri/rocket-lazy-load/commit/0266621dfe7121870f0b818673beb09f363e1793

I don't know if this is a line of development that would be useful for the plugin as it is developed here

any input on this would be great

thanks

@remyperona
Copy link
Contributor

Is the fact that the element gets the additional attributes generates any side effect for you?

The most straightforward way to target specific elements would be to specialize the elements_selector, with img[data-lazy-src] and iframe[data-lazy-src] for example

@remyperona remyperona self-assigned this Dec 12, 2018
Screenfeed added a commit that referenced this issue Dec 12, 2018
Fixes #43 Increase elements selectors specificity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants