mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-11 08:04:59 +02:00
grunt
This commit is contained in:
25
js/dist/modal.js
vendored
25
js/dist/modal.js
vendored
@@ -89,6 +89,7 @@ var Modal = function ($) {
|
||||
this._isShown = false;
|
||||
this._isBodyOverflowing = false;
|
||||
this._ignoreBackdropClick = false;
|
||||
this._isTransitioning = false;
|
||||
this._originalBodyPadding = 0;
|
||||
this._scrollbarWidth = 0;
|
||||
}
|
||||
@@ -104,6 +105,13 @@ var Modal = function ($) {
|
||||
Modal.prototype.show = function show(relatedTarget) {
|
||||
var _this = this;
|
||||
|
||||
if (this._isTransitioning) {
|
||||
throw new Error('Modal is transitioning');
|
||||
}
|
||||
|
||||
if (Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE)) {
|
||||
this._isTransitioning = true;
|
||||
}
|
||||
var showEvent = $.Event(Event.SHOW, {
|
||||
relatedTarget: relatedTarget
|
||||
});
|
||||
@@ -148,8 +156,16 @@ var Modal = function ($) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
var hideEvent = $.Event(Event.HIDE);
|
||||
if (this._isTransitioning) {
|
||||
throw new Error('Modal is transitioning');
|
||||
}
|
||||
|
||||
var transition = Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE);
|
||||
if (transition) {
|
||||
this._isTransitioning = true;
|
||||
}
|
||||
|
||||
var hideEvent = $.Event(Event.HIDE);
|
||||
$(this._element).trigger(hideEvent);
|
||||
|
||||
if (!this._isShown || hideEvent.isDefaultPrevented()) {
|
||||
@@ -168,8 +184,7 @@ var Modal = function ($) {
|
||||
$(this._element).off(Event.CLICK_DISMISS);
|
||||
$(this._dialog).off(Event.MOUSEDOWN_DISMISS);
|
||||
|
||||
if (Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE)) {
|
||||
|
||||
if (transition) {
|
||||
$(this._element).one(Util.TRANSITION_END, function (event) {
|
||||
return _this2._hideModal(event);
|
||||
}).emulateTransitionEnd(TRANSITION_DURATION);
|
||||
@@ -234,6 +249,7 @@ var Modal = function ($) {
|
||||
if (_this3._config.focus) {
|
||||
_this3._element.focus();
|
||||
}
|
||||
_this3._isTransitioning = false;
|
||||
$(_this3._element).trigger(shownEvent);
|
||||
};
|
||||
|
||||
@@ -285,7 +301,8 @@ var Modal = function ($) {
|
||||
var _this7 = this;
|
||||
|
||||
this._element.style.display = 'none';
|
||||
this._element.setAttribute('aria-hidden', true);
|
||||
this._element.setAttribute('aria-hidden', 'true');
|
||||
this._isTransitioning = false;
|
||||
this._showBackdrop(function () {
|
||||
$(document.body).removeClass(ClassName.OPEN);
|
||||
_this7._resetAdjustments();
|
||||
|
Reference in New Issue
Block a user