mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-23 05:33:02 +02:00
build
This commit is contained in:
47
js/dist/dropdown.js
vendored
47
js/dist/dropdown.js
vendored
@@ -101,6 +101,7 @@ var Dropdown = function ($) {
|
||||
this._popper = null;
|
||||
this._config = this._getConfig(config);
|
||||
this._menu = this._getMenuElement();
|
||||
this._inNavbar = this._detectNavbar();
|
||||
|
||||
this._addEventListeners();
|
||||
}
|
||||
@@ -141,17 +142,7 @@ var Dropdown = function ($) {
|
||||
element = parent;
|
||||
}
|
||||
}
|
||||
this._popper = new Popper(element, this._menu, {
|
||||
placement: this._getPlacement(),
|
||||
modifiers: {
|
||||
offset: {
|
||||
offset: this._config.offset
|
||||
},
|
||||
flip: {
|
||||
enabled: this._config.flip
|
||||
}
|
||||
}
|
||||
});
|
||||
this._popper = new Popper(element, this._menu, this._getPopperConfig());
|
||||
|
||||
// if this is a touch-enabled device we add extra
|
||||
// empty mouseover listeners to the body's immediate children;
|
||||
@@ -180,6 +171,7 @@ var Dropdown = function ($) {
|
||||
};
|
||||
|
||||
Dropdown.prototype.update = function update() {
|
||||
this._inNavbar = this._detectNavbar();
|
||||
if (this._popper !== null) {
|
||||
this._popper.scheduleUpdate();
|
||||
}
|
||||
@@ -231,10 +223,41 @@ var Dropdown = function ($) {
|
||||
} else if ($(this._menu).hasClass(ClassName.MENURIGHT)) {
|
||||
placement = AttachmentMap.BOTTOMEND;
|
||||
}
|
||||
|
||||
return placement;
|
||||
};
|
||||
|
||||
Dropdown.prototype._detectNavbar = function _detectNavbar() {
|
||||
return $(this._element).closest('.navbar').length > 0;
|
||||
};
|
||||
|
||||
Dropdown.prototype._getPopperConfig = function _getPopperConfig() {
|
||||
var _this2 = this;
|
||||
|
||||
var popperConfig = {
|
||||
placement: this._getPlacement(),
|
||||
modifiers: {
|
||||
offset: {
|
||||
offset: this._config.offset
|
||||
},
|
||||
flip: {
|
||||
enabled: this._config.flip
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (this._inNavbar) {
|
||||
popperConfig.modifiers.AfterApplyStyle = {
|
||||
enabled: true,
|
||||
order: 901, // ApplyStyle order + 1
|
||||
fn: function fn() {
|
||||
// reset Popper styles
|
||||
$(_this2._menu).attr('style', '');
|
||||
}
|
||||
};
|
||||
}
|
||||
return popperConfig;
|
||||
};
|
||||
|
||||
// static
|
||||
|
||||
Dropdown._jQueryInterface = function _jQueryInterface(config) {
|
||||
|
2
js/dist/dropdown.js.map
vendored
2
js/dist/dropdown.js.map
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user