-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
is-next-container class is not applied during transition. #8
Comments
It's a bit confusing but it actually does get applied, however just for a single frame. The class Same for the previous container, but in reverse: the starting state is the normal style without classname, and the end state is the style of Let me know if this makes a bit more sense now. We might need an adapted version of the lifecycle diagram to make this a bit more intuitive. I'm closing this as it's working as expected but feel free to get back anytime if this needs further clarification. |
Ah, I see. Thank you for the explanation, yes, this makes sense. I think some mentioning of this in the docs would be great. |
True — I've created a new issue to clarify the readme on these. |
Hm, for some reason the transforms that are supposed to be applied via the Any idea what could be wrong here and how to debug this? |
Can you create a demo with just the basic styles applied? Hard to debug this from afar otherwise. Forking the replit example and taking it step by step should also give you some pointers at which step it breaks down. |
@trych We've also updated the styling section of the readme to hopefully be more clear about when the animation classnames are added to and removed from each type of container. |
@daun Thanks, much appreciated. And also understandable, that my issue is too hard to debug, it's unfortunately a bit hard to reproduce because this was within a very involved CSS setup. I had to move on though and I switched to animating it with gsap in the end, which I got to work after a while. During coding I did thinkt that it would be helpful to have some sort of class attached to the "next-container" for the entire duration of the animation though to target it more easily with some JS or by other means. I mean I could do something with the first of type pseudo class, but then I have to be specific again that this is only valid during the animation, so a separate class for targeting this container during the animation would be helpful, I think. |
@trych Are you using this in conjunction with GSAP? Or did you decide to drop the plugin altogether? The intended use case of the plugin was for pure CSS animations: something like parallel animations has been complicated but already doable in JS, whereas it was definitely impossible to do with CSS only. That's kind of the focus of the plugin, and might be a bit of a blind spot for us conceptually. So if I'm getting this right, the main issue for JS animations is there's currently no way of applying initial styles to the next container before it's inserted into the DOM. The solution might just be a new hook — |
Yes, I use this in conjunction with GSAP and did not drop the plugin. This seems to work fine (and is still a lot easier for me than setting this up with JS only). I could not get it to work with CSS and had to get something to work quickly for a presentation today, that's why I moved to GSAP. I guess CSS only would be preferable but might be too complicated in my specific setup (it is basically entire layouts that slide vertically which is specifically challenging due to the containers being taller than 100vh).
Yeah, basically I would like to be able to easily style / target the next container during the animation. Even when I just want to give it a pink background color for debugging purposes I will have to resort to something like html.is-changing {
.my-container-class:not(.is-previous-container) {
background-color: deeppink;
}
} (off the top of my head) or something like that. Would be nicer to have a simple class like |
Hey @trych, do you have any demo to have a look at how you use GSAP with Parallel? :) Thanks <3 |
@Eric-llos Unfortunately no, nothing public and nothing that would be easy to take apart. |
@trych Oops :( Thank you anyway! |
@trych The latest version 0.3.0 adds a new hook swup.hooks.before('content:insert', (visit, { containers }) => {
for (const { next } of containers) {
console.log('About to insert container', next);
}
}); |
Hi there,
First of all, thanks for this great plugin, it is a very welcome addition to swup.
When using this plugin, the
is-previous-container
class gets applied to the previous container as described in the docs, however, theis-next-container-class
does not get applied to the newly inserted next container.This can also be seen in the demo that is linked on the plugin's doc page:
https://replit.com/@swupjs/Swup-Demo-Slideshow
The text was updated successfully, but these errors were encountered: