mirror of
https://github.com/twbs/bootstrap.git
synced 2025-01-17 09:52:29 +01:00
Merge pull request #6378 from Yohn/patch-7
fixes tooltip insert problems
This commit is contained in:
commit
b9c7f29134
@ -849,6 +849,14 @@ $('a[data-toggle="tab"]').on('shown', function (e) {
|
|||||||
<p>Object structure is: <code>delay: { show: 500, hide: 100 }</code></p>
|
<p>Object structure is: <code>delay: { show: 500, hide: 100 }</code></p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>container</td>
|
||||||
|
<td>string | false</td>
|
||||||
|
<td>false</td>
|
||||||
|
<td>
|
||||||
|
<p>Appends the tooltip to a specific element <code>container: 'body'</code></p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<div class="alert alert-info">
|
<div class="alert alert-info">
|
||||||
|
8
docs/templates/pages/javascript.mustache
vendored
8
docs/templates/pages/javascript.mustache
vendored
@ -779,6 +779,14 @@ $('a[data-toggle="tab"]').on('shown', function (e) {
|
|||||||
<p>{{_i}}Object structure is: <code>delay: { show: 500, hide: 100 }</code>{{/i}}</p>
|
<p>{{_i}}Object structure is: <code>delay: { show: 500, hide: 100 }</code>{{/i}}</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{{_i}}container{{/i}}</td>
|
||||||
|
<td>{{_i}}string | false{{/i}}</td>
|
||||||
|
<td>{{_i}}false{{/i}}</td>
|
||||||
|
<td>
|
||||||
|
<p>{{_i}}Appends the tooltip to a specific element <code>container: 'body'</code>{{/i}}</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<div class="alert alert-info">
|
<div class="alert alert-info">
|
||||||
|
4
js/bootstrap-tooltip.js
vendored
4
js/bootstrap-tooltip.js
vendored
@ -129,7 +129,8 @@
|
|||||||
$tip
|
$tip
|
||||||
.detach()
|
.detach()
|
||||||
.css({ top: 0, left: 0, display: 'block' })
|
.css({ top: 0, left: 0, display: 'block' })
|
||||||
.insertAfter(this.$element)
|
|
||||||
|
this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
|
||||||
|
|
||||||
pos = this.getPosition()
|
pos = this.getPosition()
|
||||||
|
|
||||||
@ -290,6 +291,7 @@
|
|||||||
, title: ''
|
, title: ''
|
||||||
, delay: 0
|
, delay: 0
|
||||||
, html: false
|
, html: false
|
||||||
|
, container: false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
10
js/tests/unit/bootstrap-tooltip.js
vendored
10
js/tests/unit/bootstrap-tooltip.js
vendored
@ -241,4 +241,14 @@ $(function () {
|
|||||||
.tooltip('toggle')
|
.tooltip('toggle')
|
||||||
ok($(".tooltip").is('.fade.in'), 'tooltip should be toggled in')
|
ok($(".tooltip").is('.fade.in'), 'tooltip should be toggled in')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test("should place tooltips inside the body", function () {
|
||||||
|
var tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"></a>')
|
||||||
|
.appendTo('#qunit-fixture')
|
||||||
|
.tooltip({container:'body'})
|
||||||
|
.tooltip('show')
|
||||||
|
ok($("body > .tooltip").length, 'inside the body')
|
||||||
|
ok(!$("#qunit-fixture > .tooltip").length, 'not found in parent')
|
||||||
|
tooltip.tooltip('hide')
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user