Can parallax background be isolated to vertical slide sets? #3282
Unanswered
davidlevy247
asked this question in
Q&A
Replies: 1 comment
-
Was looking for the same thing, ended up with this small workaround. Sharing it FWIW: <style>
.reveal {
background: url('./assets/img/_background.jpg');
background-size: cover;
background-position: 0 0;
transition: background-position 0.3s linear;
}
</style> <script>
Reveal.initialize({
// ...
});
const divWithBackground = document.querySelector(".reveal");
Reveal.on('slidechanged', event => {
const x = -event.indexh * 200;
const y = -event.indexv * 100;
divWithBackground.style.backgroundPosition = `${x}px ${y}px`;
});
</script> |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
reviewing doc on background, it applies to the whole presentation upon initialization.
Is there a way to have a different parallax background per set of vertical slides?
Beta Was this translation helpful? Give feedback.
All reactions