Wait Transition to finish before showing x-show #1416
Replies: 9 comments 1 reply
-
|
I guess this issue is related to another PR #713 @MuzafferDede Can you test with this example for your PR? @calebporzio If yes, possible to merge above PR fast? |
Beta Was this translation helpful? Give feedback.
-
|
The solution to your issue is actually applying delay to your transitions. (you don't have it in your code above), even tho current alpine version does support x-transition class defined delays, there is still some bugs with it. Yes, #713 will fix this bug and you could have something like this: View Code.delay-1000 {
transition-delay: 1s;
} <div x-data="{ open: 'tab1' }">
<button @click.prevent="open= 'tab1'">
Open Tab 1
</button>
<button @click.prevent="open= 'tab2'">
Open Tab 2
</button>
<button @click.prevent="open= 'tab3'">
Open Tab 3
</button>
<div x-show="open === 'tab1'">
Hey I'm tab 01
<div x-show="open === 'tab1'" x-transition:enter-start="opacity-0 scale-90" x-transition:enter="ease-out transition-slow delay-1000" x-transition:enter-end="opacity-100 scale-100" x-transition:leave-start="opacity-100 scale-100" x-transition:leave="ease-in transition-slow" x-transition:leave-end="opacity-0 scale-90">
I'm transitioning 01
</div>
</div>
<div x-show="open === 'tab2'">
Hey I'm tab 02
<div x-show="open === 'tab2'" x-transition:enter-start="opacity-0 scale-90" x-transition:enter="ease-out transition-slow delay-1000" x-transition:enter-end="opacity-100 scale-100" x-transition:leave-start="opacity-100 scale-100" x-transition:leave="ease-in transition-slow" x-transition:leave-end="opacity-0 scale-90">
I'm transitioning 02
</div>
</div>
<div x-show="open === 'tab3'">
Hey I'm tab 03
<div x-show="open === 'tab3'" x-transition:enter-start="opacity-0 scale-90" x-transition:enter="ease-out transition-slow delay-1000" x-transition:enter-end="opacity-100 scale-100" x-transition:leave-start="opacity-100 scale-100" x-transition:leave="ease-in transition-slow" x-transition:leave-end="opacity-0 scale-90">
I'm transitioning 03
</div>
</div>
</div> |
Beta Was this translation helpful? Give feedback.
-
|
@MuzafferDede For your code to work, need the code in PR? Because I have added delay as you said. But not working? https://jsfiddle.net/h5mjd78o/ How can I make it work now? because I guess @calebporzio may take time to merge this. |
Beta Was this translation helpful? Give feedback.
-
|
That PR won't fix your issue (at leats not so easily). There is a bit of misunderstanding, I think. Not sure what it's the desired output but I believe that you only need x-transition-enter (https://codepen.io/SimoTod/pen/XWdpKpG) If you really want to do something complicated like As a separate note, I would suggest to avoid things like "Maintainer, please merge it fast" in the future. The maintainer and the rest of the team receive email whenever a ticket or a discussion is open (this thread would be a discussion more than a bug, for instance) and this kind of sentences comes across badly. Let me know if the above suggestion helped. |
Beta Was this translation helpful? Give feedback.
-
|
@surjithctly #713 contains improvements and an edge case bug fix on transition(there is a ms gap which cause break on animations). As i said earlier current version does support what you need imo. But it could be in multiple approach. The one commonly used it what @SimoTod suggested in the codepen sample. Usually we skip the in animation on tabs to have a smooth switch. If you want to go If you are in rush for some reason, you could use sponsorship on github to reach out Caleb's help in person. One of the sponsor package includes
|
Beta Was this translation helpful? Give feedback.
-
|
@SimoTod I'm using similar to what you shared on codepen now. But I think an in built solution would be perfect. And sorry for asking to merge fast. New to this community 😊 @MuzafferDede Yes. I'm using similar to the codepen now. |
Beta Was this translation helpful? Give feedback.
-
|
I have the same behaviour when doing transition(in and out) with x-show where the expression is evaluated more than one time, like in the example with tabs. This will briefly show Test3 displaced underneath Test2, when activeTab becomes 3 and was 2 before. This is because the change in activeTab triggers two transitions concurrently and hence is displacing Test3 until Test2 was put to "display: none" after the transitions ended. In jQuery I addressed this behaviour with: which faded the DOM object out before it was set to display none. Afterwards another object could be faded in. I guess this could be a solution: |
Beta Was this translation helpful? Give feedback.
-
|
I've been scouting the web for almost an hour and still didn't find a solution for this issue. Does anyone have found a clean solution to transition between two elements in Alpine? |
Beta Was this translation helpful? Give feedback.
-
|
this has been an issue for 5 years now for example a multi-step form, having each step fade out, wait, and the next one fade in is impossible with alpine without implementing a ton of bizarre hacks and workarounds because you cannot specify separate back to jquery i guess |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I have a strange issue while trying to animate Tabs. I have 3 buttons for tabs, and 3 div's to display content. But when I add transition to the content. It breaks. See the below fiddle to see what I mean.
https://jsfiddle.net/0mv8husn/1/
How do I let other tab wait for the transition to finish before showing?
I have seen the pull #177 but this is not working.
View Code
Beta Was this translation helpful? Give feedback.
All reactions