diff options
author | Mark Otto <otto@github.com> | 2012-12-26 19:36:07 +0400 |
---|---|---|
committer | Mark Otto <otto@github.com> | 2012-12-26 19:36:07 +0400 |
commit | 330b143b407b01d71b707860f21e0cc2accafd49 (patch) | |
tree | c8225e3429bfc478f6bccf26f79e4e8c706da72e /docs/assets/js/bootstrap-tooltip.js | |
parent | 9749d6afc2730d41cab0111e1cc19bba7c5c3676 (diff) |
Add longer tooltip example to docs, tighten up line-height on tooltip; run make
Diffstat (limited to 'docs/assets/js/bootstrap-tooltip.js')
-rw-r--r-- | docs/assets/js/bootstrap-tooltip.js | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/docs/assets/js/bootstrap-tooltip.js b/docs/assets/js/bootstrap-tooltip.js index a184eaf496..c23d8267a8 100644 --- a/docs/assets/js/bootstrap-tooltip.js +++ b/docs/assets/js/bootstrap-tooltip.js @@ -110,8 +110,11 @@ , actualHeight , placement , tp + , e = $.Event('show') if (this.hasContent() && this.enabled) { + this.$element.trigger(e) + if (e.isDefaultPrevented()) return $tip = this.tip() this.setContent() @@ -126,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() @@ -152,6 +156,8 @@ .offset(tp) .addClass(placement) .addClass('in') + + this.$element.trigger('shown') } } @@ -166,6 +172,10 @@ , hide: function () { var that = this , $tip = this.tip() + , e = $.Event('hide') + + this.$element.trigger(e) + if (e.isDefaultPrevented()) return $tip.removeClass('in') @@ -184,6 +194,8 @@ removeWithAnimation() : $tip.detach() + this.$element.trigger('hidden') + return this } @@ -242,8 +254,8 @@ } , toggle: function (e) { - var self = $(e.currentTarget)[this.type](this._options).data(this.type) - self[self.tip().hasClass('in') ? 'hide' : 'show']() + var self = e ? $(e.currentTarget)[this.type](this._options).data(this.type) : this + self.tip().hasClass('in') ? self.hide() : self.show() } , destroy: function () { @@ -279,6 +291,7 @@ , title: '' , delay: 0 , html: false + , container: false } @@ -290,4 +303,4 @@ return this } -}(window.jQuery);
\ No newline at end of file +}(window.jQuery); |