1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-10 07:37:27 +02:00
This commit is contained in:
Mark Otto
2017-09-09 16:59:37 -07:00
parent cad22335ed
commit d8a5147c38
30 changed files with 251 additions and 265 deletions

30
js/dist/dropdown.js vendored
View File

@@ -78,23 +78,21 @@ var Dropdown = function () {
};
var Default = {
placement: AttachmentMap.BOTTOM,
offset: 0,
flip: true
};
var DefaultType = {
placement: 'string',
offset: '(number|string)',
flip: 'boolean'
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var Dropdown = function () {
function Dropdown(element, config) {
_classCallCheck(this, Dropdown);
@@ -201,11 +199,6 @@ var Dropdown = function () {
}, {
key: '_getConfig',
value: function _getConfig(config) {
var elementData = $(this._element).data();
if (typeof elementData.placement !== 'undefined') {
elementData.placement = AttachmentMap[elementData.placement.toUpperCase()];
}
config = $.extend({}, this.constructor.Default, $(this._element).data(), config);
Util.typeCheckConfig(NAME, config, this.constructor.DefaultType);
@@ -225,10 +218,10 @@ var Dropdown = function () {
key: '_getPlacement',
value: function _getPlacement() {
var $parentDropdown = $(this._element).parent();
var placement = this._config.placement;
var placement = AttachmentMap.BOTTOM;
// Handle dropup
if ($parentDropdown.hasClass(ClassName.DROPUP) || this._config.placement === AttachmentMap.TOP) {
if ($parentDropdown.hasClass(ClassName.DROPUP)) {
placement = AttachmentMap.TOP;
if ($(this._menu).hasClass(ClassName.MENURIGHT)) {
placement = AttachmentMap.TOPEND;
@@ -256,9 +249,10 @@ var Dropdown = function () {
enabled: this._config.flip
}
}
};
// Disable Popper.js for Dropdown in Navbar
};if (this._inNavbar) {
// Disable Popper.js for Dropdown in Navbar
if (this._inNavbar) {
popperConfig.modifiers.applyStyle = {
enabled: !this._inNavbar
};