1 (function($, undefined) {
4 var ChButton = function(element, options) {
5 $.fn.ch_widget.Constructor(element, options);
6 this.$element = $(element);
7 this.options = $.extend({}, $.fn.ch_widget.defaults);
10 ChButton.prototype = $.extend(
12 $.fn.ch_widget.Constructor.prototype,
18 $.fn.ch_button = function(option) {
19 return this.each(function() {
21 data = $this.data('ch_button'),
22 options = typeof option == 'object' && option;
25 $this.data('ch_button', (data = new ChButton(this, options)));
33 $.fn.ch_button.Constructor = ChButton;
36 * ================= */
38 $('body').on('click.ch_button.data-api', '[data-toggle^=ch-button]', function(e) {
39 var $btn = $(e.target);
40 if (!$btn.hasClass('btn'))
41 $btn = $btn.closest('.btn');
43 $btn.ch_button('toggle');
47 $('.btn, button, input[type=button]').ch_button();