Skip to content
This repository has been archived by the owner on Jun 14, 2020. It is now read-only.

Commit

Permalink
Fix problem when setting show/hide targets on non-rendered tooltips, …
Browse files Browse the repository at this point in the history
…causing tooltip to only show on second show event firing. Thanks @kabel
  • Loading branch information
Craga89 committed Oct 15, 2012
1 parent 141f50b commit c35afc5
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 38 deletions.
24 changes: 12 additions & 12 deletions dist/basic/jquery.qtip.js
Expand Up @@ -924,6 +924,18 @@ function QTip(target, options, id, attr)

toggle: function(state, event)
{
// Try to prevent flickering when tooltip overlaps show element
if(event) {
if((/over|enter/).test(event.type) && (/out|leave/).test(cache.event.type) &&
options.show.target.add(event.target).length === options.show.target.length &&
tooltip.has(event.relatedTarget).length) {
return self;
}

// Cache event
cache.event = $.extend({}, event);
}

// Render the tooltip if showing and it isn't already
if(!self.rendered) { return state ? self.render(1) : self; }

Expand All @@ -943,18 +955,6 @@ function QTip(target, options, id, attr)
// Return if element is already in correct state
if(!tooltip.is(':animated') && visible === state && sameTarget) { return self; }

// Try to prevent flickering when tooltip overlaps show element
if(event) {
if((/over|enter/).test(event.type) && (/out|leave/).test(cache.event.type) &&
options.show.target.add(event.target).length === options.show.target.length &&
tooltip.has(event.relatedTarget).length) {
return self;
}

// Cache event
cache.event = $.extend({}, event);
}

// tooltipshow/tooltiphide events
if(!triggerEvent(type, [90])) { return self; }

Expand Down

0 comments on commit c35afc5

Please sign in to comment.