You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This has been covered in many requests but no one has provided an easy solution.
Here is the issue:
Many want to option to center align the dropdown.
(Sure it can be hardcoded with css positioning but that is bad practice as it doesn't take use of the popper.js extension keeping content within the screen boundaries).
ANSWER:
IT ALREADY EXISTS, someone just forgot it when creating the AttachmentMap.
I've tested the below code and it indeed works.
SOLUTION:
// affected files dropdown.js (which is somehow built into bootstrap.bundle.js so that file as well)
// approx line 48
var ClassName = {
....
//add this line:
MENUCENTER: 'dropdown-menu-center', // add new css class for center align dropdown
....
};
// approx line 65
var AttachmentMap = {
....
//add this line:
BOTTOMCENTER: 'bottom', // 'bottom' already exists in popper.js. this just maps to that placement.
....
};
// approx 227
_proto._getPlacement = function _getPlacement() {
....
//add these 3 lines
} else if ($(this._menu).hasClass(ClassName.MENUCENTER)) {
placement = AttachmentMap.BOTTOMCENTER;
}
....
return placement;
};
Thats it. A total of FIVE lines will give everyone the ability to center their dropdowns.
HOW?? can this be added?
The text was updated successfully, but these errors were encountered:
Acts7
changed the title
Bootstrap 4 dropdown AttachmentMap 'bottom' (which centers the dropdown)
Bootstrap 4 Dropdown Centering | AttachmentMap 'bottom' Placement is missing
Feb 15, 2018
This has been covered in many requests but no one has provided an easy solution.
Here is the issue:
Many want to option to center align the dropdown.
(Sure it can be hardcoded with css positioning but that is bad practice as it doesn't take use of the popper.js extension keeping content within the screen boundaries).
ANSWER:
IT ALREADY EXISTS, someone just forgot it when creating the AttachmentMap.
I've tested the below code and it indeed works.
SOLUTION:
// affected files dropdown.js (which is somehow built into bootstrap.bundle.js so that file as well)
Thats it. A total of FIVE lines will give everyone the ability to center their dropdowns.
HOW?? can this be added?
The text was updated successfully, but these errors were encountered: