| @@ -24,12 +24,13 @@ | ||
| 24 | 24 | if ( ! $this->is_lazy_load_background_images_enabled() ) { |
| 25 | 25 | return; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | + if ( ! $this->should_lazy_load_background_images() ) { | |
| 29 | + return; | |
| 30 | + } | |
| 31 | + | |
| 28 | 32 | add_action( 'wp_head', function() { |
| 29 | - if ( ! $this->should_lazy_load_background_images() ) { | |
| 30 | - return; | |
| 31 | - } | |
| 32 | 33 | ?> |
| 33 | 34 | <style> |
| 34 | 35 | .e-con.e-parent:nth-of-type(n+4):not(.e-lazyloaded):not(.e-no-lazyload), |
| 35 | 36 | .e-con.e-parent:nth-of-type(n+4):not(.e-lazyloaded):not(.e-no-lazyload) * { |
| @@ -51,11 +52,8 @@ | ||
| 51 | 52 | <?php |
| 52 | 53 | } ); |
| 53 | 54 | |
| 54 | 55 | add_action( 'wp_footer', function() { |
| 55 | - if ( ! $this->should_lazy_load_background_images() ) { | |
| 56 | - return; | |
| 57 | - } | |
| 58 | 56 | ?> |
| 59 | 57 | <script> |
| 60 | 58 | const lazyloadRunObserver = () => { |
| 61 | 59 | const lazyloadBackgrounds = document.querySelectorAll( `.e-con.e-parent:not(.e-lazyloaded)` ); |