.destroy - OtagJS/Otag GitHub Wiki
.destroy( start, duration ) => Promise
Arguments | Type | Unit | Default | Description |
---|---|---|---|---|
start | Number | ms | 0 | When .destroy class be added |
duration | Number | ms | 300 | Time between class addition and item removal |
It adds destroy class to the Element start ms after call. Then removes the Element from document after duration.
Reasonable when with a CSS rule like:
.destroy {
opacity: 0;
transition: .3s cubic-bezier(0.9, -0.5, 1, 1);
transform: scale(.0);
}
duration should be equal to CSS property, transition-duration
This method returns Promise which will be solved after Element removal.