Title: Using plugin with background images
Last modified: August 31, 2016

---

# Using plugin with background images

 *  Resolved [giadina12](https://wordpress.org/support/users/giadina12/)
 * (@giadina12)
 * [10 years ago](https://wordpress.org/support/topic/using-plugin-with-background-images/)
 * Hi, I use you plugin on my website with good result.
    However, into the home 
   page, the script don’t work because I have different sections (it’s a parallel
   one page theme) who use backgrounds.
 * I see on the setting that your plugin can work with this type of image with the
   specific set where you say:
    Lazy load background images. Note: 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>”
 * Well, I tried to implement this without to find a right way.
    My section who 
   call the background image appear on code as this:
 * ************************************
    <section class=”serv_intro intro” <?php
   if ($smof_data[‘serv_intro_img’]) { ?> style=”background-image: url(<?php echo
   $smof_data[‘serv_intro_img’]; ?>);” <?php } ?>> <div class=”black_over”> <div
   class=”container text_center”> <div class=”intro_pad”> <?php if ($smof_data[‘
   serv_intro_h1’]) { ?> <h1><?php printf( __($smof_data[‘serv_intro_h1’])); ?></
   h1> <?php } ?> <?php if ($smof_data[‘serv_intro_h2’]) { ?> <h2><?php printf( 
   __($smof_data[‘serv_intro_h2’])); ?></h2> <?php } ?> </div> </div> </div> </section
   > ************************************
 * Do you have a suggestion on where I need to add the “data-bg=” tag?
 * Aright, thank you for any help.
    Giadina
 * [https://wordpress.org/plugins/lazy-load-xt/](https://wordpress.org/plugins/lazy-load-xt/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [sgrx](https://wordpress.org/support/users/sgrx/)
 * (@sgrx)
 * [10 years ago](https://wordpress.org/support/topic/using-plugin-with-background-images/#post-7417649)
 * You’re applying the background image to the section tag, so I believe you’ll 
   have to add data-bg to that tag itself?
 * I can’t get it to work with background images for me. The image doesn’t lazy 
   load when I add data-bg to the div tag where the image is applied. It loads during
   the page load itself.
 *  Is there a jQuery version requirement or some other requirement for this plugin
   to work? I just have jquery.js?ver=1.12.3′ which my theme loads.
 *  Thread Starter [giadina12](https://wordpress.org/support/users/giadina12/)
 * (@giadina12)
 * [10 years ago](https://wordpress.org/support/topic/using-plugin-with-background-images/#post-7417655)
 * Hi,
    I have followed your suggestions and I have fixed this problem setting in
   this way:
 * from:
    <section class=”serv_intro intro” <?php if ($smof_data[‘serv_intro_img’]){?
   > style=”background-image: url(<?php echo $smof_data[‘serv_intro_img’]; ?>);”
   <?php } ?>>
 * to:
    <section class=”serv_intro_img” data-bg=<?php echo $smof_data[‘serv_intro_img’];?
   > <?php if ($smof_data[‘about_intro_img’]) { ?>
 * <?php } ?>>
 * In this way, the browser “call” the background only when in the screen.
    I have
   saved 50% of page size.
 * So, thanks a lot for your help.
    Thanks 🙂 Giadina.
 *  [sgrx](https://wordpress.org/support/users/sgrx/)
 * (@sgrx)
 * [10 years ago](https://wordpress.org/support/topic/using-plugin-with-background-images/#post-7417670)
 * It’s not working for me, sadly. [https://wordpress.org/support/topic/lazy-load-background-images?replies=1](https://wordpress.org/support/topic/lazy-load-background-images?replies=1)
 *  Thread Starter [giadina12](https://wordpress.org/support/users/giadina12/)
 * (@giadina12)
 * [10 years ago](https://wordpress.org/support/topic/using-plugin-with-background-images/#post-7417677)
 * Hi, let me see this on monday.
    I will try. I am not too much expert.
 *  [sgrx](https://wordpress.org/support/users/sgrx/)
 * (@sgrx)
 * [10 years ago](https://wordpress.org/support/topic/using-plugin-with-background-images/#post-7417691)
 * Thanks

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Using plugin with background images’ is closed to new replies.

 * ![](https://ps.w.org/lazy-load-xt/assets/icon-256x256.png?rev=1094664)
 * [Lazy Load XT](https://wordpress.org/plugins/lazy-load-xt/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/lazy-load-xt/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/lazy-load-xt/)
 * [Active Topics](https://wordpress.org/support/plugin/lazy-load-xt/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/lazy-load-xt/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/lazy-load-xt/reviews/)

## Tags

 * [backgrounds](https://wordpress.org/support/topic-tag/backgrounds/)

 * 5 replies
 * 2 participants
 * Last reply from: [sgrx](https://wordpress.org/support/users/sgrx/)
 * Last activity: [10 years ago](https://wordpress.org/support/topic/using-plugin-with-background-images/#post-7417691)
 * Status: resolved