aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Stevens <[email protected]>2012-06-18 19:25:54 -0700
committerJon Stevens <[email protected]>2012-06-18 19:25:54 -0700
commit6a974f9ff7962afc9aaf5510055e574d147a6c42 (patch)
tree6abc813dc8e1f7fe64ea880afd1df129c8377ded
parentbae3cfd18343ce4909b26f03ee0008f0de1d2d46 (diff)
downloadbootstrap-6a974f9ff7962afc9aaf5510055e574d147a6c42.tar.xz
bootstrap-6a974f9ff7962afc9aaf5510055e574d147a6c42.zip
enable the ability to destroy tooltips and popovers from elements. related to issue #3453
-rw-r--r--docs/templates/pages/javascript.mustache8
-rw-r--r--js/bootstrap-popover.js6
-rw-r--r--js/bootstrap-tooltip.js6
3 files changed, 19 insertions, 1 deletions
diff --git a/docs/templates/pages/javascript.mustache b/docs/templates/pages/javascript.mustache
index 0a3a7aa80..bad720889 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 c6c1f8b47..456b74bdd 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 f5f9fad3f..93525b8bd 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')
+ }
+
}