Is it possible to somehow lazy load a BB Row Background Photo?

I have tested with BJ Lazy Load (https://wordpress.org/plugins/bj-lazy-load/), A3 Lazy Load (https://wordpress.org/plugins/a3-lazy-load/) and Lazy Load (https://wordpress.org/plugins/lazy-load/) but non of them are capable of lazy loading background images. I even tried tweaking the last plugin (Lazy Load) by adding the suggested code:

if ( function_exists( 'lazyload_images_add_placeholders' ) )
    ob_start( 'lazyload_images_add_placeholders' );

Which the author claims will lazy load all images on a website (https://wordpress.org/plugins/lazy-load/faq/) but to no avail.

Perhaps someone here will have a clever idea on how to lazy load a BB Row Background Photo?

Best regards,
Michael

This looks interesting in relation to BB Row Background Images but it would be nice to have a fallback option without JS. Plugin TBD?
http://www.appelsiini.net/projects/lazyload/enabled_background.html

Hi Michael! Is the issue loading background images specific to Beaver Builder, or is it for any css background image?

Michael, following up after doing some reading. It looks like this is a problem with background images period; not just Beaver Builder’s implementation? I am not familiar with any techniques to lazy load bg images, unfortunately.

In reference to your other question (http://forum.wpbeaverbuilder.com/support/q/lazy-load-bb-content-slider/), you might look into another slider plugin. Like Ben mentioned, we’re using bxSlider and I believe they leverage background images.

If you find any solutions to the bg image lazy load issue, we’d love to know. You could try asking in some of our user communities too:

https://beaverbuilders.herokuapp.com/
https://www.facebook.com/groups/beaverbuilders/

Sorry we don’t have a better answer right now.

Hi Robby,

You are correct it is not specifically related to Beaver Builder’s implementation. The trouble is that I have chosen to use the Hope BB theme as a base for the front page since it reduced the number of HTTP requests (compared to using a slider). I have added a couple more row’s with background images however and that’s when I noticed the need to lazy load CSS BG images to reduce the page size.

The only solution I have been able to find is the jQuery lazy load script which is capable of lazy loading CSS BG images:
http://www.appelsiini.net/projects/lazyload/enabled_background.html

I am now experimenting with JCH Optimize (https://www.jch-optimize.net) to minify/optimize delivery of JS / CSS and lazy loading images. Incidentally the author of that plugin use the jQuery lazy load plugin (as mentioned above) to load in normal page images. I have suggested that he should extend his plugin to include lazy load of CSS BG images using the implementation mentioned above.

I can also recommend the above mentioned plugin in the Pro version btw. Using that plugin I have been able to further reduce the number of HTTP requests from 59 to 15 without breaking my website which is quite impressive to say the least.

Best regards,
Michael

Hi,

This is very interesting topic I think also need special attention from BB developers simply its correlated with many thing like [Page Speed - Minify css html js - reduced HTTP requests] I try many plugins my self to tune wordpress sites and I have very good result with:

Beaver Builder surely need to be tune and optimize for page speed and minified setting with reduced http requests for example let’s see the test result for http://forum.wpbeaverbuilder.com :

1- https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Fwww.wpbeaverbuilder.com
2- https://gtmetrix.com/reports/www.wpbeaverbuilder.com/1m6oQRDY
3- http://www.webpagetest.org/result/151025_SE_PE1/

As you can see from the result there is many room for speed improvement.

Thanks,
alhawiyadesign

I agree - Design and Optimal delivery must go hand in hand.

Anyway I already got a reply back from the author of JCH Optimize on lazy loading CSS BG images. He says that it is indeed possible under these circumstances:

Lazy load for background images can still be implemented but it would only work for background images declared in inline styles or styles attributes on elements, not in external css files.
https://www.jch-optimize.net/forum/submit-feature-request/260-lazy-load-option.html?start=6

So from what I understand it would require optional delivery of BB CSS BG images through inline CSS instead of the current setup with external CSS.

I hope there is a speed improvement for BB in these areas:

  • Improved performance locating WordPress photos.
  • Tune and optimize for page speed loading.
  • Reduce http requests.
  • Minified setting for [css-html-js].
  • Add builtin lazy loading to [BB_image], [BB_gallery], [BB_content_section],
    ,[BB_video],[BB_shortcodes],[BB_Templates].

Hi guys! Thanks so much for the responses and the information. We’re very interested in optimizing Beaver Builder and ensuring that it generates efficient/optimal code. A few of these suggestions we prefer to leave up to caching plugins.

If either of you guys have a second, please feel free to add or vote up any of these suggestions on our User Voice page.

Also, if you’re interested in contributing we’d love to hear from you. We’re also hiring developers :slight_smile:

Thanks, guys!

Hi Robby,

I hear what you are saying and I am personally using:

JCH Optimize Pro (https://www.jch-optimize.net/) for optimal delivery of CSS and JS. This plugin also significantly reduces the number of HTTP requests.

For lazy loading I have used BJ Lazy Load (https://wordpress.org/plugins/bj-lazy-load/)

But more recently I have started using Lazy Load XT (https://wordpress.org/plugins/lazy-load-xt/)
which also supports lazy loading of background images (if the page is properly configured for it - more details below). This is often overseen and I have noticed that elements on a fluid/responsive BeaverBuilder page often utilize background elements such as images. Unfortunately BB pages are currently not correctly configured for lazy loading of such elements.

Citing the author of Lazy Load XT the following syntax needs to be added to BB pages to ensure lazy loading of background images:
‘‘You must add the attribute “data-bg” with a value of path to the image to elements with a background image.
E.g. “<div data-bg=”/path/to/image.png">…</div>"’’

This seems to confirm the previous research that I have done on this matter (see previous posts above). I hope that this information is of some use to BB developers.

Keep up the good work guys! :slight_smile:

Best regards,
Michael

I hope that this information is of some use to BB developers.

I am sure it will be. Thanks, Michael.