I try to make the carriage rotate 180 degrees with a click for my dropdown menu. In the solution I'm trying to implement, it changes the carriage class to switch or click-to-switch. The first time I click on it, it rotates, the second time it immediately returns to its original position and then rotates back. I smell dirty code, the easiest way to add this switch rotation animation. Thanks in advance for any help.
Heres my current css:
.toggle-up { animation-name: toggle-up; animation-delay: 0.25s; animation-duration: 0.75s; animation-fill-mode: forwards; } .toggle-down { animation-name: toggle-down; animation-delay: 0.25s; animation-duration: 0.75s; animation-fill-mode: forwards; } @keyframes toggle-up { 100% { transform: rotate(180deg); } } @keyframes toggle-down { 100% { transform: rotate(180deg); } }

javascript html css css-animations
Daniel Kobe
source share