Open
Description
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
Metadata
Metadata
Assignees
Labels
No labels