Sorry, but i have no time to support or/and develop this plugin. If someone want to continue his developement, he can contact me. Contact E-mail : edouard@tackacoder.fr
This is a switch and stylish jquery plugin that converts checkbox to toggle switch button. This plugin allows to choose between three options.
The toggle button switch with CSS3 animation.
You can use it with swipe option (Perform by Hammerjs)
<link rel="stylesheet" href="https://github.com/EdouardTack/candlestick/blob/master/path/to/font-awesome.min.css">
<link rel="stylesheet" href="https://github.com/EdouardTack/candlestick/blob/master/dist/candlestick.min.css">
<script src="https://github.com/EdouardTack/candlestick/raw/master/dist/candlestick.min.js" type="text/javascript"></script>
Load dependencies for swipe option
<script src="https://github.com/EdouardTack/candlestick/raw/master/path/to/hammerjs/hammer.min.js" type="text/javascript"></script>
<script src="https://github.com/EdouardTack/candlestick/raw/master/path/to/jquery-hammerjs/jquery-hammer.js" type="text/javascript"></script>
Create html field (id is neccessary)
<input class="js-candlestick" type="checkbox" name="candlestick" value="1" id="myId>
and then use it
$('.js-candlestick').candlestick();
different options and methods
$('.js-candlestick').candlestick({
'mode': 'options', // "contents" is the other mode
'contents': { // Options for "contents" mode
'left': 'Left', // The left content
'middle': 'Middle', // The middle content
'right': 'Right', // The right content
'swipe': true // enable the global swipe mode
},
'on': '1', // for on value
'off': '0', // for off value
'nc': '', // for none/default value
'swipe': true, // for swipe
'size': 'md', // Sizes (lg, md (default), sm, xs)
'debug': false, // Display some log message. used with Candlestick.log()
'allowManualDefault': true, // Enable the three options, set to false will disable the default option
afterAction: function(input, wrapper, action) {
// Fired after action
},
afterRendering: function(input, wrapper) {
// Fired after rendering element
},
afterOrganization: function(input, wrapper) {
// Fired after organization method
},
afterSetting: function(input, wrapper, value) {
// Fired after setting value
}
});
input -> the html field input[type=hidden]
wrapper -> the wrapper element [class=candlestick-bg]
Set candle option
$(".js-candlestick").candlestick('on');
$(".js-candlestick").candlestick('off');
$(".js-candlestick").candlestick('default'); or $(".js-candlestick").candlestick('reset');
Enable / Disable candle
$(".js-candlestick").candlestick('enable');
$(".js-candlestick").candlestick('disable');
Reset candle option
We can reset candlestick in form, for example, with click on button.
<input class="js-candlestick" type="checkbox" name="candlestick" value="0" id="ID">
// Button to reset form
$(MY_ELEMENT_BUTTON).on('click', function(e) {
e.preventDefault();
// With the class you use to create candlestick
// reset all candlestick
$(".js-candlestick").candlestick('reset');
// or with the ID of the input[type=checkbox] element
// reset only one candlestick
$("#ID").candlestick('reset');
});
More options for swipe
$('.js-candlestick').candlestick({
'swipe': {
enabled: true, // for swipe
mobile: true, // Only for mobile/tablet (to develop)
desktop: true, // Only for desktop (to develop)
transition: false // On value to off value / *true* On value to Default value to Off value
}
});
Create new branch for helping development
npm update
bower update
The MIT License (MIT)
Copyright (c) 2015
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.