1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-09 23:26:40 +02:00

Better placement for Dropdown + Handle flip of Tooltip/Popover

This commit is contained in:
Johann-S
2017-04-19 10:20:50 +02:00
parent d5fabf8de5
commit 18e4e851e2
3 changed files with 15 additions and 3 deletions

View File

@@ -65,8 +65,8 @@ const Dropdown = (($) => {
}
const AttachmentMap = {
TOP : 'top',
BOTTOM : 'bottom'
TOP : 'top-start',
BOTTOM : 'bottom-start'
}
const Default = {

View File

@@ -287,6 +287,12 @@ const Tooltip = (($) => {
offset : {
offset : this.config.offset
}
},
onCreate : (data) => {
this._handlePopperPlacementChange(data)
},
onUpdate : (data) => {
this._handlePopperPlacementChange(data)
}
})
@@ -637,6 +643,12 @@ const Tooltip = (($) => {
}
}
_handlePopperPlacementChange(data) {
if (data.originalPlacement !== data.placement) {
this._cleanTipClass()
this.addAttachmentClass(this._getAttachment(data.placement))
}
}
// static