From 7ecaecab5274afb731acf131b7166653a7652290 Mon Sep 17 00:00:00 2001 From: Cristian Deluxe Date: Sun, 7 Feb 2016 03:10:44 +0100 Subject: [PATCH] Add option handlestyle --- README.md | 1 + js/bootstrap-toggle.js | 5 ++++- js/bootstrap-toggle.min.js | 2 +- js/bootstrap-toggle.min.js.map | 2 +- js/bootstrap2-toggle.js | 5 ++++- js/bootstrap2-toggle.min.js | 2 +- js/bootstrap2-toggle.min.js.map | 2 +- package.json | 1 + 8 files changed, 14 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index f9c0dcd..9de4944 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,7 @@ off|string/html|"Off"|Text of the off toggle size|string|"normal"|Size of the toggle. Possible values are `large`, `normal`, `small`, `mini`. onstyle|string|"primary"|Style of the on toggle. Possible values are `default`, `primary`, `success`, `info`, `warning`, `danger` offstyle|string|"default"|Style of the off toggle. Possible values are `default`, `primary`, `success`, `info`, `warning`, `danger` +handlestyle|string|"default"|Style of the handle toggle. Possible values are `default`, `primary`, `success`, `info`, `warning`, `danger` style|string| |Appends the value to the class attribute of the toggle. This can be used to apply custom styles. Refer to Custom Styles for reference. width|integer|*null*|Sets the width of the toggle. if set to *null*, width will be calculated. height|integer|*null*|Sets the height of the toggle. if set to *null*, height will be calculated. diff --git a/js/bootstrap-toggle.js b/js/bootstrap-toggle.js index 533914e..3208ce7 100644 --- a/js/bootstrap-toggle.js +++ b/js/bootstrap-toggle.js @@ -26,6 +26,7 @@ off: 'Off', onstyle: 'primary', offstyle: 'default', + handlestyle: 'default', size: 'normal', style: '', width: null, @@ -38,6 +39,7 @@ off: this.$element.attr('data-off') || Toggle.DEFAULTS.off, onstyle: this.$element.attr('data-onstyle') || Toggle.DEFAULTS.onstyle, offstyle: this.$element.attr('data-offstyle') || Toggle.DEFAULTS.offstyle, + handlestyle: this.$element.attr('data-handlestyle') || Toggle.DEFAULTS.handlestyle, size: this.$element.attr('data-size') || Toggle.DEFAULTS.size, style: this.$element.attr('data-style') || Toggle.DEFAULTS.style, width: this.$element.attr('data-width') || Toggle.DEFAULTS.width, @@ -48,6 +50,7 @@ Toggle.prototype.render = function () { this._onstyle = 'btn-' + this.options.onstyle this._offstyle = 'btn-' + this.options.offstyle + this._handlestyle = 'btn-' + this.options.handlestyle var size = this.options.size === 'large' ? 'btn-lg' : this.options.size === 'small' ? 'btn-sm' : this.options.size === 'mini' ? 'btn-xs' @@ -56,7 +59,7 @@ .addClass(this._onstyle + ' ' + size) var $toggleOff = $('