/ios7-switch

iOS7 Style Switch

Primary LanguageJavaScript

ios7-switch

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.

Installation

$ component install mnmly/ios7-switch

Example

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)

License

MIT