Kalypto

Created & copyright (c) by Mike Behnke

http://www.local-pc-guy.com
Twitter: @LocalPCGuy

Description: Kalypto is a basic plugin to allow you to use a simple sprite graphic in place of a checkbox or radio button. Styles for the checked/non-checked state should be defined in a stylesheet and a sprite added, and the plugin handles building a new element, changes the class and keeps the checkbox or radio button updated with the correct state. You can style the selected and unselected states with any CSS you want (even avoid a sprite, if you want to generate an image in some other method available to CSS).

Requirements: jQuery is a requirement, Kalypto was original built against jQuery version 1.7.6, and should work through later versions. Basic use requires CSS styles for normal and selected state as well as a sprite that contains each state.

Kalypto = καλυπτω (Greek) which translates to "to cover, to conceal"





usage:

        $("input[name=rDemo]").kalypto({hideInputs: false});
$("#checkboxDemo").kalypto({hideInputs: false});

Events: (bound on the input)

        k_elbuilt: when an element is first built 
k_checked: when an element is checked
k_unchecked: when an element is checked

options/defaults:

        {
            toggleClass: "toggle",               // This is the base class for the created element
            checkedClass: "checked",             // This is the active (or selected/checked) class
            hideInputs: true,                    // If for some reason you don't want to hide the inputs, mainly in for the demo page
            copyInputClasses: true,              // If there are classes on the input, by default they will be copied to the new element
            dataLabel: "",                       // If you want text in your custom element, you can add it with a data-label attribute on the input (data-label="Custom Text")
            checkedEvent: "k_checked",           // This event will be triggered on the input when it is checked
            uncheckedEvent: "k_unchecked",       // This event will be triggered on the input when it is unchecked
            elBuiltEvent: "k_elbuilt",           // This event will be triggered on the input when the custom element is built
            customClasses: ""                    // If you want to add custom classes when it is built, add them here
        }
        

View Kalypto on GitHub

Released under MIT License
http://lpg.mit-license.org/