Personally I really don’t like mimicking native UIs, but I find it interesting to see how these tiny interactions work on iOS7 Switch
.
So I did a quick research to find out how those tiny bits are moving around :)
☞ Demo
Here’s the major frames of turning on / turning off interaction.
$ component install mnmly/ios7-switch
var Switch = require('ios7-switch')
, checkbox = document.querySelector('input')
, mySwitch = new Switch(checkbox);
// When `mySwitch` is clicked toggle state
mySwitch.el.addEventListener('click', function(e){
e.preventDefault();
mySwitch.toggle();
}, false)
MIT