Skip to content

Commit

Permalink
Avoid relying on has-background class for lazy-loading background i…
Browse files Browse the repository at this point in the history
…mages
  • Loading branch information
ShyamGadde committed Nov 29, 2024
1 parent 3a50808 commit ce351c2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ private function lazy_load_bg_images( OD_Tag_Visitor_Context $context ): void {
$processor->append_head_html(
'<style>
@media (scripting: enabled) {
.has-background.od-lazy-bg-image {
.od-lazy-bg-image {
background-image: none !important;
}
}
Expand Down
4 changes: 1 addition & 3 deletions plugins/image-prioritizer/lazy-load-bg-image.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ const lazyBgImageObserver = new IntersectionObserver(
}
);

const bgImageElements = document.querySelectorAll(
'.has-background.od-lazy-bg-image'
);
const bgImageElements = document.querySelectorAll( '.od-lazy-bg-image' );
for ( const bgImageElement of bgImageElements ) {
lazyBgImageObserver.observe( bgImageElement );
}

0 comments on commit ce351c2

Please sign in to comment.