@ipekulfetkaylan
Posted
Hello, you can toggle with css and give a class to shape this class. When the user clicks the toggle button, you can have it scroll right and left. For this, you can select the class you give for toggle in js and assign a click event to it. You can add a new class to the transition when the user clicks it. In this class for example you can push the toggle button 20px to the left. For example: const toggleEl= document.querySelector('.toggle'); const switchEL= document.querySelector('.switch'); switchEL.addEventListener('click',()=>{ toggleEl.classList.toggle('active') }) Css: .toggle.active .switch{ left: 21px; }