lib/assets/javascripts/up/tooltip.js.coffee in upjs-rails-0.13.0 vs lib/assets/javascripts/up/tooltip.js.coffee in upjs-rails-0.14.0
- old
+ new
@@ -90,10 +90,13 @@
The HTML to display in the tooltip.
@param {String} [options.position='top']
The position of the tooltip. Known values are `top` and `bottom`.
@param {String} [options.animation]
The animation to use when opening the tooltip.
+ @return {Promise}
+ A promise that will be resolved when the tooltip's opening animation has finished.
+ @stable
###
attach = (linkOrSelector, options = {}) ->
$link = $(linkOrSelector)
html = u.option(options.html, $link.attr('up-tooltip-html'))
text = u.option(options.text, $link.attr('up-tooltip'))
@@ -110,10 +113,11 @@
Does nothing if no tooltip is currently shown.
@function up.tooltip.close
@param {Object} options
See options for [`up.animate`](/up.animate).
+ @stable
###
close = (options) ->
$tooltip = $('.up-tooltip')
if $tooltip.length
options = u.options(options, animation: config.closeAnimation)
@@ -136,17 +140,19 @@
Defaults to [`up.tooltip.config.openAnimation`](/up.tooltip.config).
@param {String} [up-position]
The default position of tooltips relative to the element.
Can be either `"top"` or `"bottom"`.
Defaults to [`up.tooltip.config.position`](/up.tooltip.config).
+ @stable
###
###*
Displays a tooltip with HTML content when hovering the mouse over this element:
<a href="/decks" up-tooltip="Show <b>all</b> decks">Decks</a>
@selector [up-tooltip-html]
+ @stable
###
up.compiler('[up-tooltip], [up-tooltip-html]', ($link) ->
# Don't register these events on document since *every*
# mouse move interaction bubbles up to the document.
$link.on('mouseover', -> attach($link))