Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit ef6ea35

Browse files
fix(#10): fix lazy images and reveal
1 parent 04d3d8c commit ef6ea35

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/components/slides/deckdeckgo-slide.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ export class DeckDeckGoSlideUtils {
1414
return;
1515
}
1616

17-
const elements: NodeListOf<HTMLElement> = el.querySelectorAll(revealShowFirst ? '[slot] > li:not(:first-child), [slot] > p:not(:first-child), [slot] > span:not(:first-child), [slot] > img:not(:first-child)' : '[slot] > li, [slot] > p, [slot] > span, [slot] > img, img');
17+
const elements: NodeListOf<HTMLElement> = el.querySelectorAll(revealShowFirst ? '[slot] > li:not(:first-child), [slot] > p:not(:first-child), [slot] > span:not(:first-child), [slot] > img:not(:first-child)' : '[slot] > li, [slot] > p, [slot] > span, [slot] > img');
1818

1919
if (!elements) {
2020
resolve();
2121
} else {
2222
Array.from(elements).forEach((element: HTMLElement) => {
2323
element.style.setProperty('visibility', 'hidden');
24+
element.classList.add('deckgo-reveal');
2425
});
2526
}
2627
});
@@ -107,7 +108,10 @@ export class DeckDeckGoSlideUtils {
107108
image.setAttribute('src', image.getAttribute('data-src'));
108109
image.removeAttribute('data-src');
109110

110-
image.style.setProperty('visibility', 'initial');
111+
// If image is part of a reveal group, let it be revealed with the reveal feature
112+
if (!image.classList.contains('deckgo-reveal')) {
113+
image.style.setProperty('visibility', 'initial');
114+
}
111115
}
112116

113117
// Furthermore to lazy loading, we set pointer-events to none. Doing so we prevent images of being dragged.

0 commit comments

Comments
 (0)