Skip to content

A CSS/JS reimplementation of UI switch for WebKit and Gecko.

Notifications You must be signed in to change notification settings

aronallen/switchify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Switchify

Switchify is a jQuery plugin that emulates a switch from UIKit in WebKit/Gecko.

It uses jQuery Data to store it's options and elements, these are name spaced switchify:options and switchify:elements, respectivly, and can be accessed if you need to.

If you need to manipulate any options, do so by calling Switchify again, and pass in the differing options. 


##Supported Browsers
              

Tested in the following browsers:

IE 8, 9
Firefox 7 
Safari 5
Opera  11
Chrome 15

##Sample

http://aronallen.com/samples/switchify/

##Parameters

Switchify accepts two parameters, the first parameter is the options parameter.
                                


###Options

- size: 44, //the height of the switch, the width is calculated from this value depending on the string lengths
- strings:
	- on: "ON", //the label shown when the switch is on.
	- off: "OFF", //the label shown when the switch is off.
- state: true, //the state of the switch (access this value externally by $(element).data('switchify:options').state)
- shading: true, //whether to apply shading on the switch or not (gradients and box-shadows)
- clickable: true //whether the user can click the switch, instead of dragging it.
                                                                                                                                       
###Callback
          
The second parameter is a callback parameter, it is called each time the user has stopped interacting, and the animations have ended.  

function(state){
		console.log(state);
}                     

##Attributions
Embedded BrowserDetect from http://www.quirksmode.org/js/detect.html
                                                                         

##License
                                                                                                                          
You are free to use the plugin as you see fit.
If you use my plugin, please consider attributing me somewhere on your site with a link to my homepage or to the github project page.  

Thank you!

About

A CSS/JS reimplementation of UI switch for WebKit and Gecko.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published