from.remove() when the user does not wait for the transition to be completed (with overlap)
See original GitHub issueHello!
I’m using Highway to make overlap transition. Everything works fine but the old page isn’t remove if the user click on a link before the end of the transition.
I didn’t use gasp (or any other transition library), I use keyframes from my CSS and run from.remove() with a setTimeout. Maybe that’s where the problem’s coming from?
//main.js
import Highway from './highway.module.js';
import Overlap from './CustomTransition.js';
(() => {
const H = new Highway.Core({
transitions: {
default: Overlap
}
});
})();
//CustomTransition.js
import Highway from './highway.module.js';
class Overlap extends Highway.Transition {
in({ from, to, trigger, done }) {
from.style.position = 'absolute';
to.style.animation = "overlapTest 1s";
let timeremove = setTimeout(() => from.remove(), 1200)
done();
}
out({ from, done }) {
done();
}
}
export default Overlap;
/*style.css*/
@keyframes overlapTest {
from{ transform: translateX(100vw); }
to{transform: translateX(0); }
}
I have make a demo with a transition of 1s => https://eloquent-heisenberg-124835.netlify.app/
I have also make a repo : https://github.com/Totokoutonio/Highway_Overlap
Thx for helping!
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Remove class added with hover and animationend on mouseout
Thus, it does not wait for animation if a user takes the mouse out of the element before the transition completes. On the...
Read more >How transitions are created in Final Cut Pro - Apple Support
Transitions require overlapping video from the clips on each side of the edit point. A one-second transition requires one second of video from...
Read more >Smooth and simple transitions with the View Transitions API
The View Transition API allows page transitions within single-page apps, and will later include multi-page apps.
Read more >Wait for Page Load in React | Ship Shape
The Solution To delay the animation further, and ensure no overlap with the rest of the page loading, I decided to fully wait...
Read more >Animation transitions - Unity - Manual
The interruption order works, conceptually, as if transitions are queued and then parsed for a valid transition from the first transition inserted to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ThaoD5 I have use
animationend
and it works well!Thanks a lot, I close this issue.
For a cleaner approach, I would advise to use an event like
'transitionend
on the element that has your transition animation, that way you’re not playing with settimeout, but this is a very personal approach. 😃Glad that solution worked for you !