Hi there,
Yes, lazyload only works on <img>
and not on background styling. While X theme options for background uses <img>
, so lazyload will work just fine. It uses backstretch library ( http://www.jquery-backstretch.com/ ), perhaps you can use the sample library to implement your preferred background while having the lazyload.
Unfortunately, you can’t override theme’s options background image since it doesn’t through backstretch javascript library. Overriding it with javascript will not work too since the options are generated with PHP. This is the code responsible for that,
function x_customizer_output_js() {
$x_custom_scripts = x_get_option( 'x_custom_scripts' );
$entry_id = get_the_ID();
$x_entry_bg_image_full = get_post_meta( $entry_id, '_x_entry_bg_image_full', true );
$x_entry_bg_image_full_fade = get_post_meta( $entry_id, '_x_entry_bg_image_full_fade', true );
$x_entry_bg_image_full_duration = get_post_meta( $entry_id, '_x_entry_bg_image_full_duration', true );
$x_design_bg_image_full = x_get_option( 'x_design_bg_image_full' );
$x_design_bg_image_full_fade = x_get_option( 'x_design_bg_image_full_fade' );
?>
<?php if ( $x_custom_scripts ) : ?>
<script id="x-customizer-js">
<?php echo $x_custom_scripts; ?>
</script>
<?php endif; ?>
<?php if ( $x_entry_bg_image_full && is_singular() ) : ?>
<?php
$page_bg_images_output = '';
$page_bg_images = explode( ',', $x_entry_bg_image_full );
foreach ( $page_bg_images as $page_bg_image ) {
$page_bg_images_output .= '"' . $page_bg_image . '", ';
}
$page_bg_images_output = trim( $page_bg_images_output, ', ' );
?>
<script>jQuery.backstretch([<?php echo $page_bg_images_output; ?>], {duration: <?php echo $x_entry_bg_image_full_duration; ?>, fade: <?php echo $x_entry_bg_image_full_fade; ?>});</script>
<?php elseif ( $x_design_bg_image_full ) : ?>
<script>jQuery.backstretch(['<?php echo x_make_protocol_relative( $x_design_bg_image_full ); ?>'], {fade: <?php echo $x_design_bg_image_full_fade; ?>});</script>
<?php endif;
}
add_action( 'wp_footer', 'x_customizer_output_js', 9999, 0 );
You must do it the same way if you wish for lazyload works 
Thanks!