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

Commit

Permalink
Browse files Browse the repository at this point in the history
Reorganised toggle method
  • Loading branch information
Craga89 committed Dec 12, 2010
1 parent 2c226e7 commit 02ebc7a
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 34 deletions.
2 changes: 1 addition & 1 deletion dist/jquery.qtip.css
Expand Up @@ -9,7 +9,7 @@
* http://en.wikipedia.org/wiki/MIT_License
* http://en.wikipedia.org/wiki/GNU_General_Public_License
*
* Date: Sun Dec 12 01:43:24 2010 +0000
* Date: Sun Dec 12 02:01:38 2010 +0000
*/

.ui-tooltip-accessible{
Expand Down
31 changes: 15 additions & 16 deletions dist/jquery.qtip.js
Expand Up @@ -9,7 +9,7 @@
* http://en.wikipedia.org/wiki/MIT_License
* http://en.wikipedia.org/wiki/GNU_General_Public_License
*
* Date: Sun Dec 12 01:43:24 2010 +0000
* Date: Sun Dec 12 02:01:38 2010 +0000
*/

"use strict"; // Enable ECMAScript "strict" operation for this function. See more: http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/
Expand Down Expand Up @@ -828,10 +828,23 @@ function QTip(target, options, id)
visible = tooltip.is(':visible'),
callback, ieStyle;


// Detect state if valid one isn't provided
if((typeof state).search('boolean|number')) { state = !tooltip.is(':visible'); }

// Return if element is already in correct state
if((!visible && !state) || tooltip.is(':animated')) { return self; }

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

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

// Define after callback
function after()
{
Expand All @@ -856,20 +869,6 @@ function QTip(target, options, id)
}
}

// Return if element is already in correct state
if((!visible && !state) || tooltip.is(':animated')) { return self; }

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

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

// Call API methods
callback = $.Event('tooltip'+type);
callback.originalEvent = event ? self.cache.event : NULL;
Expand Down
2 changes: 1 addition & 1 deletion dist/jquery.qtip.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/jquery.qtip.pack.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 14 additions & 15 deletions src/core.js
Expand Up @@ -803,10 +803,23 @@ function QTip(target, options, id)
visible = tooltip.is(':visible'),
callback, ieStyle;


// Detect state if valid one isn't provided
if((typeof state).search('boolean|number')) { state = !tooltip.is(':visible'); }

// Return if element is already in correct state
if((!visible && !state) || tooltip.is(':animated')) { return self; }

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

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

// Define after callback
function after()
{
Expand All @@ -831,20 +844,6 @@ function QTip(target, options, id)
}
}

// Return if element is already in correct state
if((!visible && !state) || tooltip.is(':animated')) { return self; }

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

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

// Call API methods
callback = $.Event('tooltip'+type);
callback.originalEvent = event ? self.cache.event : NULL;
Expand Down

0 comments on commit 02ebc7a

Please sign in to comment.