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

Staggering data-emergence Toggle #19

Open
shshaw opened this issue Jan 17, 2018 · 0 comments
Open

Staggering data-emergence Toggle #19

shshaw opened this issue Jan 17, 2018 · 0 comments

Comments

@shshaw
Copy link

shshaw commented Jan 17, 2018

When multiple items are suddenly made visible, it would be great to have an option that would stagger the [data-emergence=visible] change based on source order. This allows for some really appealing intro animations for sections of a site. This prevents having to hard-code transition-delay or animation-delay in the CSS, which will cause unnecessary delays if items are not made visible at the same time.

For example:

<body>
<div class="scene-1" data-emergence="hidden" style="height: 33vh"></div>
<div class="scene-2" data-emergence="hidden" style="height: 33vh"></div>
<div class="scene-3" data-emergence="hidden" style="height: 33vh"></div>
</body>

JS:

emergence.init({
   stagger: 100 // Delay in ms between item attribute changes
});

Because all items are revealed in the viewport at the same time and the stagger option is set:
.scene-1 gets data-emergence=visible change right away
.scene-2 gets data-emergence=visible after 100ms
.scene-3 gets data-emergence=visible after 200ms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant