mirror of
https://github.com/twbs/bootstrap.git
synced 2024-11-29 11:24:18 +01:00
Tooltip: apply position class before positioning
This commit is contained in:
parent
09cdee2f03
commit
55fa1acbd6
2
docs/assets/js/bootstrap.js
vendored
2
docs/assets/js/bootstrap.js
vendored
@ -1159,6 +1159,7 @@
|
||||
$tip
|
||||
.detach()
|
||||
.css({ top: 0, left: 0, display: 'block' })
|
||||
.addClass(placement)
|
||||
|
||||
this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
|
||||
|
||||
@ -1195,7 +1196,6 @@
|
||||
|
||||
$tip
|
||||
.offset(offset)
|
||||
.addClass(placement)
|
||||
.addClass('in')
|
||||
|
||||
var actualWidth = $tip[0].offsetWidth
|
||||
|
2
docs/assets/js/bootstrap.min.js
vendored
2
docs/assets/js/bootstrap.min.js
vendored
File diff suppressed because one or more lines are too long
@ -291,4 +291,18 @@ $(function () {
|
||||
container.remove()
|
||||
}, 100)
|
||||
})
|
||||
|
||||
test("should add position class before positioning so that position-specific styles are taken into account", function(){
|
||||
$("head").append('<style> .tooltip.right { white-space: nowrap; } .tooltip.right .tooltip-inner { max-width: none; } </style>')
|
||||
|
||||
var container = $("<div />").appendTo("body")
|
||||
, target = $('<a href="#" rel="tooltip" title="very very very very very very very very long tooltip in one line">To my right</a>')
|
||||
.appendTo(container)
|
||||
.tooltip({placement: 'right'})
|
||||
.tooltip('show')
|
||||
, tooltip = container.find(".tooltip")
|
||||
|
||||
ok( Math.round(target.offset().top + target[0].offsetHeight/2 - tooltip[0].offsetHeight/2) === tooltip.offset().top )
|
||||
target.tooltip('hide')
|
||||
})
|
||||
})
|
||||
|
@ -147,6 +147,7 @@
|
||||
$tip
|
||||
.detach()
|
||||
.css({ top: 0, left: 0, display: 'block' })
|
||||
.addClass(placement)
|
||||
|
||||
this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
|
||||
|
||||
@ -183,7 +184,6 @@
|
||||
|
||||
$tip
|
||||
.offset(offset)
|
||||
.addClass(placement)
|
||||
.addClass('in')
|
||||
|
||||
var actualWidth = $tip[0].offsetWidth
|
||||
|
Loading…
Reference in New Issue
Block a user