mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-11 16:14:04 +02:00
Better placement for Dropdown + Handle flip of Tooltip/Popover
This commit is contained in:
@@ -65,8 +65,8 @@ const Dropdown = (($) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const AttachmentMap = {
|
const AttachmentMap = {
|
||||||
TOP : 'top',
|
TOP : 'top-start',
|
||||||
BOTTOM : 'bottom'
|
BOTTOM : 'bottom-start'
|
||||||
}
|
}
|
||||||
|
|
||||||
const Default = {
|
const Default = {
|
||||||
|
@@ -287,6 +287,12 @@ const Tooltip = (($) => {
|
|||||||
offset : {
|
offset : {
|
||||||
offset : this.config.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
|
// static
|
||||||
|
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<h1>Popover <small>Bootstrap Visual Test</small></h1>
|
<h1>Popover <small>Bootstrap Visual Test</small></h1>
|
||||||
|
|
||||||
<button type="button" class="btn btn-secondary" data-container="body" data-toggle="popover" data-placement="top" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus.">
|
<button type="button" class="btn btn-secondary" data-container="body" data-toggle="popover" data-placement="top" data-content="Default placement was on top but not enough place">
|
||||||
Popover on top
|
Popover on top
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user