Source file: vendor/automattic/jetpack-lazy-images/src/lazy-images.php
View in GitHubParameters
- true
-
(bool) true Whether lazy image loading should occur.
Changelog
Since: Jetpack 5.6.0
apply_filters ( 'lazyload_is_enabled', bool true )
Source file: vendor/automattic/jetpack-lazy-images/src/lazy-images.php
View in GitHub(bool) true Whether lazy image loading should occur.
Since: Jetpack 5.6.0
Is there a way to use this filter, or even manually set an image to lazy load? I noticed photon users a preg_match_all to find images using an tag but it doesn’t find background images.
That filter will not allow you to enable Lazy Load for images that are not lazy loaded today.
If Lazy Images does not pick up some of your images right away, could you start a new issue here and give us some details about your theme and the images that don’t get picked up? We’ll see if we can edit Jetpack so it starts taking those images into account.
Thank you!
Hi Jeremy,
Thanks for your reply.
I see the preg_match_all function on Jetpack is searching for “”.
Problem for me is my theme (like many others) uses parallax images and those images are set as backgrounds, like this:
<
section id=”section1″ data-overlay=”5″ data-vc-parallax-image=”https://image.url”>
::before
<
div class=”background-image-holder” style=”transform: translate3d(0px, -1262.31px, 0px); background: url(“https://image.url”); opacity: 1;”>
As you can see, the image is loaded as the layer background, and Jetpack does not catch that.
That’s a good point. Do you think you could open an issue here with more details about your theme, so we can consider how to add support for that theme and others like it?
Thank you!
Done! And sorry about my incomplete response here, I didn’t notice the code I posted here got completely broken.
Is there a way to exclude certain images on the page from being lazy loaded?
I want them to load normally.
For example on archive page where posts have Masonry layout, lazy load changes layout after you scroll to images that where not in viewport.
I know that I can do relayout on masonry after lazy load but that’s going to be very jittery.
That’s not an option right now, but it will become possible early next month, when Jetpack 5.9 becomes available; the update will allow you to mark images so Lazy Load does not get applied to them, by adding the
skip-lazy
CSS class to the image.Ok, thanks Jeremy for swift reply. 😉
Now just change the 12, ‘slug’, ‘Title’ to whatever page you want to exclude from lazy loading 😉
Or remove the whole array() and add a single field.
hello, could you tell me how to add_filter with buddypress avatar crop?
Richard,
I’m not quite sure what you mean here. Can you explain more about what you’re trying to do?
Thanks! 🙂
Sorry, my bad. I use Buddypress Plugin and when I upload avatar user, unfortunately lazy load effect to the image (avatar) then it is not showing up. I try to add_filer which certain page slug ‘members’ but it is not work. So I wonder there any way to disable lazy load with specific src or div class. I also tried filter by black list classes image but not work.
Richard,
Ah, I see now. The code that Sergio posted above seems like it should work to selectively disable lazy load on certain pages, though I have not tested it. Writing custom code to integrate two plugins isn’t really something we can help with though. Have you tried using the page ID maybe?
Sorry I can’t be of more help here! 😦
Adam,
Okay I will try another solution. Thank you for reply.
Does it work with android phone?
Yes, the feature works in all browsers.