Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spin 140 #44

Merged
merged 1 commit into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions blocks/svgator/svgator.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,19 @@ export default function decorate(block) {
block.classList.add('svg-loaded');

// initialize svgator
const identifier = container.querySelector('svg').getAttribute('id');
const element = document.getElementById(identifier);
const element = container.querySelector('svg');
const player = element ? element.svgatorPlayer : {};
if (player.play) {
player.play();
}
const observer = new IntersectionObserver((entries) => {
if (entries[0].isIntersecting) {
if (player.play) {
player.play();
}
observer.disconnect();
}
}, {
threshold: 1.0,
});
observer.observe(element);
}).catch((error) => {
// Remove class and thus also remove the skeleton styling
block.classList.remove(...block.classList);
Expand Down
2 changes: 2 additions & 0 deletions blocks/svgator/svgs/animation1/animatable.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions blocks/svgator/svgs/animation1/animation.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions blocks/svgator/svgs/animation2/animatable.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions blocks/svgator/svgs/animation2/animation.js

Large diffs are not rendered by default.

Loading