Nice job! Tip: instead of using the left and right properties for moving the knob, you could also use transform: translateX() which will give you better performance (especially if animating things), since it does not require the browser to repaint and re-layout anything, it only updates in the compositor phase.
Here's my version of your switch: codepen.io/awolfika/pen/yryeGb
I am a software development engineer in test for Infosys. My job is officially to write automated tests in Selenium Webdriver. I'm also a web developer as a hobbyest
Nice job! Tip: instead of using the
left
andright
properties for moving the knob, you could also usetransform: translateX()
which will give you better performance (especially if animating things), since it does not require the browser to repaint and re-layout anything, it only updates in the compositor phase.Here's my version of your switch: codepen.io/awolfika/pen/yryeGb
I'll keep that in mind!