diff options
| author | fat-kun <[email protected]> | 2012-12-24 16:17:25 -0800 |
|---|---|---|
| committer | fat-kun <[email protected]> | 2012-12-24 16:17:25 -0800 |
| commit | b9c7f29134f2fa81931fa4663fc40ef7a0e363d1 (patch) | |
| tree | bab9cb035733392d6a5e5823e8ddd25bd130f877 | |
| parent | 90cdef8dfe851b1444ce19089376f1ceb6d4484a (diff) | |
| parent | 340d90138c86bdd86e74712d53c776c77f17c477 (diff) | |
| download | bootstrap-b9c7f29134f2fa81931fa4663fc40ef7a0e363d1.tar.xz bootstrap-b9c7f29134f2fa81931fa4663fc40ef7a0e363d1.zip | |
Merge pull request #6378 from Yohn/patch-7
fixes tooltip insert problems
| -rw-r--r-- | docs/javascript.html | 8 | ||||
| -rw-r--r-- | docs/templates/pages/javascript.mustache | 8 | ||||
| -rw-r--r-- | js/bootstrap-tooltip.js | 4 | ||||
| -rw-r--r-- | js/tests/unit/bootstrap-tooltip.js | 10 |
4 files changed, 29 insertions, 1 deletions
diff --git a/docs/javascript.html b/docs/javascript.html index 37f7df925..917b90ae9 100644 --- a/docs/javascript.html +++ b/docs/javascript.html @@ -849,6 +849,14 @@ $('a[data-toggle="tab"]').on('shown', function (e) { <p>Object structure is: <code>delay: { show: 500, hide: 100 }</code></p> </td> </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> </table> <div class="alert alert-info"> diff --git a/docs/templates/pages/javascript.mustache b/docs/templates/pages/javascript.mustache index dee6bb0f9..e0b291e1d 100644 --- a/docs/templates/pages/javascript.mustache +++ b/docs/templates/pages/javascript.mustache @@ -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> </td> </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> </table> <div class="alert alert-info"> diff --git a/js/bootstrap-tooltip.js b/js/bootstrap-tooltip.js index 8c8673387..7f9588283 100644 --- a/js/bootstrap-tooltip.js +++ b/js/bootstrap-tooltip.js @@ -129,7 +129,8 @@ $tip .detach() .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() @@ -290,6 +291,7 @@ , title: '' , delay: 0 , html: false + , container: false } diff --git a/js/tests/unit/bootstrap-tooltip.js b/js/tests/unit/bootstrap-tooltip.js index 1370ef381..ef21bd96b 100644 --- a/js/tests/unit/bootstrap-tooltip.js +++ b/js/tests/unit/bootstrap-tooltip.js @@ -241,4 +241,14 @@ $(function () { .tooltip('toggle') 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') + }) }) |
