Is there any way to use the same transition on the same element at two different times? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Is there any way to use the same transition on the same element at two different times?

I was hoping that this would work but it doesn't seem to be possible unless I am just doing it wrong. I have discovered other work-arounds such as using .style.left for one transition and .style.transform for the other transition and separating them with a comma. I can also use animations and a 3rd way is to add more divs so that I can have more IDs and then do the transitions on them. It is part of a larger project that I am working on for practice and every time that I want to animate the same element, I have to use one of those other methods to do it. It just seems like it would have have been so much easier if I could use a function with arguments to use the same transition on the same element at different times. As you can see in the code, you can only do one or the other. If both are used, only the close function works. If you comment out the close function, then the open function works... 🤔 https://code.sololearn.com/W5qa9NT4dsiu/?ref=app

23rd Apr 2019, 3:37 AM
Decimis † 𝕯𝖊𝖈𝖎𝖒𝖎𝖘
Decimis † 𝕯𝖊𝖈𝖎𝖒𝖎𝖘 - avatar
6 Answers
+ 2
setTimeout for the later transition
23rd Apr 2019, 6:09 AM
Calviղ
Calviղ - avatar
+ 1
Calviղ Hmm, I haven't experienced at all with setTimeout yet. Guess I'll have to look into it.
23rd Apr 2019, 3:20 PM
Decimis † 𝕯𝖊𝖈𝖎𝖒𝖎𝖘
Decimis † 𝕯𝖊𝖈𝖎𝖒𝖎𝖘 - avatar
+ 1
Calviղ Ah well that seems to work fine. Thanks 👍
23rd Apr 2019, 4:37 PM
Decimis † 𝕯𝖊𝖈𝖎𝖒𝖎𝖘
Decimis † 𝕯𝖊𝖈𝖎𝖒𝖎𝖘 - avatar
0
Hai
5th May 2019, 10:30 AM
Marshall Gans
Marshall Gans - avatar
0
Marshall Gans Do you know what "anarchy" is? What would come about from it? Nobody with a bit of sense should be supporting it. Anarchy suits nothing but evil and those who thrive by evil. It is the lack of law and order and control where crime is unpunished and unstoppable. If you are alright with someone breaking a window of your house and throwing a torch in, or just coming in and taking whatever they want with no fear at all of being caught, or enslaving your sisters then you can support anarchy...
5th May 2019, 2:01 PM
Decimis † 𝕯𝖊𝖈𝖎𝖒𝖎𝖘
Decimis † 𝕯𝖊𝖈𝖎𝖒𝖎𝖘 - avatar
0
Transision
15th May 2019, 8:57 PM
Smart Sudhakar