Skip to content

Commit

Permalink
Better menu support
Browse files Browse the repository at this point in the history
  • Loading branch information
Youpinadi committed Nov 20, 2013
1 parent 5f04538 commit 136418b
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/javascripts/jquery.tipsy.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
if (title && this.enabled) {
var $tip = this.tip();

if ($tip.is(':visible'))
{
return true;
}

$tip.find('.tipsy-inner')[this.options.html ? 'html' : 'text'](title);
$tip[0].className = 'tipsy'; // reset classname in case of dynamic gravity
$tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).prependTo(document.body);
Expand Down Expand Up @@ -81,6 +86,12 @@
},

hide: function() {

if (this.options.target)
{
$(this.options.target).html($('.tipsy-inner', this.tip()).html());
}

if (this.options.fade) {
this.tip().stop().fadeOut(function() { $(this).remove(); });
} else {
Expand Down Expand Up @@ -147,15 +158,15 @@
return this;
}

options = $.extend({}, $.fn.tipsy.defaults, options);

if (options.target)
{
options.html = true;
options.interactive = true;
options.delayOut = 100;
}

options = $.extend({}, $.fn.tipsy.defaults, options);

function get(ele) {
var tipsy = $.data(ele, 'tipsy');
if (!tipsy) {
Expand Down Expand Up @@ -292,11 +303,10 @@
*/

$(function(){
$j('.js-tipsy').each(function()
$('.js-tipsy').each(function()
{
var options = $j(this).data('tipsy-options') || {};
$j(this).tipsy(options);
var options = $(this).data('tipsy-options') || {};
$(this).tipsy(options);
});
});
})(jQuery);

0 comments on commit 136418b

Please sign in to comment.