From 6a974f9ff7962afc9aaf5510055e574d147a6c42 Mon Sep 17 00:00:00 2001 From: Jon Stevens <latchkey@gmail.com> Date: Mon, 18 Jun 2012 19:25:54 -0700 Subject: [PATCH] enable the ability to destroy tooltips and popovers from elements. related to issue #3453 --- docs/templates/pages/javascript.mustache | 8 +++++++- js/bootstrap-popover.js | 6 ++++++ js/bootstrap-tooltip.js | 6 ++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/docs/templates/pages/javascript.mustache b/docs/templates/pages/javascript.mustache index 0a3a7aa808..bad7208890 100644 --- a/docs/templates/pages/javascript.mustache +++ b/docs/templates/pages/javascript.mustache @@ -755,6 +755,9 @@ $('a[data-toggle="tab"]').on('shown', function (e) { <h4>.tooltip('toggle')</h4> <p>{{_i}}Toggles an element's tooltip.{{/i}}</p> <pre class="prettyprint linenums">$('#element').tooltip('toggle')</pre> + <h4>.tooltip('destroy')</h4> + <p>{{_i}}Destroys an element's tooltip.{{/i}}</p> + <pre class="prettyprint linenums">$('#element').tooltip('destroy')</pre> </section> @@ -821,7 +824,7 @@ $('a[data-toggle="tab"]').on('shown', function (e) { <td>{{_i}}trigger{{/i}}</td> <td>{{_i}}string{{/i}}</td> <td>'hover'</td> - <td>{{_i}}how tooltip is triggered{{/i}} - hover | focus | manual</td> + <td>{{_i}}how popover is triggered{{/i}} - hover | focus | manual</td> </tr> <tr> <td>{{_i}}title{{/i}}</td> @@ -867,6 +870,9 @@ $('a[data-toggle="tab"]').on('shown', function (e) { <h4>.popover('toggle')</h4> <p>{{_i}}Toggles an elements popover.{{/i}}</p> <pre class="prettyprint linenums">$('#element').popover('toggle')</pre> + <h4>.popover('popover')</h4> + <p>{{_i}}Destroys an element's popover.{{/i}}</p> + <pre class="prettyprint linenums">$('#element').popover('destroy')</pre> </section> diff --git a/js/bootstrap-popover.js b/js/bootstrap-popover.js index c6c1f8b473..456b74bdd4 100644 --- a/js/bootstrap-popover.js +++ b/js/bootstrap-popover.js @@ -71,6 +71,12 @@ return this.$tip } + , destroy: function () { + var $e = this.$element + $e.off() + $e.removeData('popover') + } + }) diff --git a/js/bootstrap-tooltip.js b/js/bootstrap-tooltip.js index f5f9fad3f4..93525b8bd3 100644 --- a/js/bootstrap-tooltip.js +++ b/js/bootstrap-tooltip.js @@ -235,6 +235,12 @@ this[this.tip().hasClass('in') ? 'hide' : 'show']() } + , destroy: function () { + var $e = this.$element + $e.off() + $e.removeData('tooltip') + } + } -- GitLab