0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-01 13:24:25 +01:00

enable the ability to destroy tooltips and popovers from elements. related to issue #3453

This commit is contained in:
Jon Stevens 2012-06-18 19:25:54 -07:00
parent bae3cfd183
commit 6a974f9ff7
3 changed files with 19 additions and 1 deletions

View File

@ -755,6 +755,9 @@ $('a[data-toggle="tab"]').on('shown', function (e) {
<h4>.tooltip('toggle')</h4> <h4>.tooltip('toggle')</h4>
<p>{{_i}}Toggles an element's tooltip.{{/i}}</p> <p>{{_i}}Toggles an element's tooltip.{{/i}}</p>
<pre class="prettyprint linenums">$('#element').tooltip('toggle')</pre> <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> </section>
@ -821,7 +824,7 @@ $('a[data-toggle="tab"]').on('shown', function (e) {
<td>{{_i}}trigger{{/i}}</td> <td>{{_i}}trigger{{/i}}</td>
<td>{{_i}}string{{/i}}</td> <td>{{_i}}string{{/i}}</td>
<td>'hover'</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>
<tr> <tr>
<td>{{_i}}title{{/i}}</td> <td>{{_i}}title{{/i}}</td>
@ -867,6 +870,9 @@ $('a[data-toggle="tab"]').on('shown', function (e) {
<h4>.popover('toggle')</h4> <h4>.popover('toggle')</h4>
<p>{{_i}}Toggles an elements popover.{{/i}}</p> <p>{{_i}}Toggles an elements popover.{{/i}}</p>
<pre class="prettyprint linenums">$('#element').popover('toggle')</pre> <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> </section>

View File

@ -71,6 +71,12 @@
return this.$tip return this.$tip
} }
, destroy: function () {
var $e = this.$element
$e.off()
$e.removeData('popover')
}
}) })

View File

@ -235,6 +235,12 @@
this[this.tip().hasClass('in') ? 'hide' : 'show']() this[this.tip().hasClass('in') ? 'hide' : 'show']()
} }
, destroy: function () {
var $e = this.$element
$e.off()
$e.removeData('tooltip')
}
} }