|
@@ -27,6 +27,7 @@
|
|
var BootstrapSwitch;
|
|
var BootstrapSwitch;
|
|
BootstrapSwitch = (function() {
|
|
BootstrapSwitch = (function() {
|
|
function BootstrapSwitch(element, options) {
|
|
function BootstrapSwitch(element, options) {
|
|
|
|
+ var initInterval;
|
|
if (options == null) {
|
|
if (options == null) {
|
|
options = {};
|
|
options = {};
|
|
}
|
|
}
|
|
@@ -109,14 +110,19 @@
|
|
if (this.options.indeterminate) {
|
|
if (this.options.indeterminate) {
|
|
this.$element.prop("indeterminate", true);
|
|
this.$element.prop("indeterminate", true);
|
|
}
|
|
}
|
|
- this._initWidth();
|
|
|
|
- this._containerPosition(this.options.state, (function(_this) {
|
|
|
|
|
|
+ initInterval = window.setInterval((function(_this) {
|
|
return function() {
|
|
return function() {
|
|
- if (_this.options.animate) {
|
|
|
|
- return _this.$wrapper.addClass("" + _this.options.baseClass + "-animate");
|
|
|
|
|
|
+ if (_this.$wrapper.is(":visible")) {
|
|
|
|
+ _this._width();
|
|
|
|
+ _this._containerPosition(null, function() {
|
|
|
|
+ if (_this.options.animate) {
|
|
|
|
+ return _this.$wrapper.addClass("" + _this.options.baseClass + "-animate");
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ return window.clearInterval(initInterval);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
- })(this));
|
|
|
|
|
|
+ })(this), 50);
|
|
this._elementHandlers();
|
|
this._elementHandlers();
|
|
this._handleHandlers();
|
|
this._handleHandlers();
|
|
this._labelHandlers();
|
|
this._labelHandlers();
|
|
@@ -436,21 +442,6 @@
|
|
return this.$wrapper.width(this._handleWidth + this._labelWidth);
|
|
return this.$wrapper.width(this._handleWidth + this._labelWidth);
|
|
};
|
|
};
|
|
|
|
|
|
- BootstrapSwitch.prototype._initWidth = function() {
|
|
|
|
- var widthInterval;
|
|
|
|
- if (this.$wrapper.is(":visible")) {
|
|
|
|
- return this._width();
|
|
|
|
- }
|
|
|
|
- return widthInterval = window.setInterval((function(_this) {
|
|
|
|
- return function() {
|
|
|
|
- if (_this.$wrapper.is(":visible")) {
|
|
|
|
- _this._width();
|
|
|
|
- return window.clearInterval(widthInterval);
|
|
|
|
- }
|
|
|
|
- };
|
|
|
|
- })(this), 50);
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
BootstrapSwitch.prototype._containerPosition = function(state, callback) {
|
|
BootstrapSwitch.prototype._containerPosition = function(state, callback) {
|
|
if (state == null) {
|
|
if (state == null) {
|
|
state = this.options.state;
|
|
state = this.options.state;
|