资 源 简 介
iPhone toggle buttons for dojo
I decided that I really liked the iPhone toggle button and decided that I wanted to use it on a project. Surprisingly I was only able to find javascript implementations of this button for jQuery and prototype. My favorite library however is Dojo. So I decided to create a Dojo back end with the styles created by Elijah Miller shown here:
http://jqr.github.com/2009/08/05/iphone-toggle-switches.html
It"s very easy to use this class. After you have imported it either by dojo.require or having all the code on your page you can just run something like this... assuming you have a div with the id container:
var button = new hp.iPhoneButton({id:"checkbox",onText:"ON",offText:"OFF",width:200,animateSpeed:200,startOn:false});dojo.place(button.domNode, dojo.byId("container"))
All of the constructor args are actually optional. If you leave them all out it creates the default button