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

Commit

Permalink
Added fix to unfocus by yshaul to allow it to work with nested tooltips
Browse files Browse the repository at this point in the history
  • Loading branch information
Craga89 committed Feb 21, 2012
1 parent 6ff3d1e commit 14b8b7d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
7 changes: 4 additions & 3 deletions dist/jquery.qtip.basic.js
Expand Up @@ -9,7 +9,7 @@
* http://en.wikipedia.org/wiki/MIT_License
* http://en.wikipedia.org/wiki/GNU_General_Public_License
*
* Date: Tue Feb 21 04:13:49 2012 +0000
* Date: Tue Feb 21 04:19:40 2012 +0000
*/

/*jslint browser: true, onevar: true, undef: true, nomen: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: true */
Expand Down Expand Up @@ -549,9 +549,10 @@ function QTip(target, options, id, attr)
if(('' + options.hide.event).indexOf('unfocus') > -1) {
targets.body.bind('mousedown'+namespace, function(event) {
var $target = $(event.target),
enabled = !tooltip.hasClass(disabled) && tooltip.is(':visible');
enabled = !tooltip.hasClass(disabled) && tooltip.is(':visible'),
isAncestor = $target.parents(selector).filter(tooltip[0]).length > 0;

if($target[0] !== tooltip[0] && $target.parents(selector).length === 0 &&
if($target[0] !== tooltip[0] && !isAncestor &&
!$target.closest(target).length && !$target.attr('disabled')
) {
self.hide(event);
Expand Down
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: Tue Feb 21 04:13:49 2012 +0000
* Date: Tue Feb 21 04:19:40 2012 +0000
*/

/* Core qTip styles */
Expand Down
7 changes: 4 additions & 3 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: Tue Feb 21 04:13:49 2012 +0000
* Date: Tue Feb 21 04:19:40 2012 +0000
*/

/*jslint browser: true, onevar: true, undef: true, nomen: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: true */
Expand Down Expand Up @@ -549,9 +549,10 @@ function QTip(target, options, id, attr)
if(('' + options.hide.event).indexOf('unfocus') > -1) {
targets.body.bind('mousedown'+namespace, function(event) {
var $target = $(event.target),
enabled = !tooltip.hasClass(disabled) && tooltip.is(':visible');
enabled = !tooltip.hasClass(disabled) && tooltip.is(':visible'),
isAncestor = $target.parents(selector).filter(tooltip[0]).length > 0;

if($target[0] !== tooltip[0] && $target.parents(selector).length === 0 &&
if($target[0] !== tooltip[0] && !isAncestor &&
!$target.closest(target).length && !$target.attr('disabled')
) {
self.hide(event);
Expand Down
4 changes: 2 additions & 2 deletions dist/jquery.qtip.min.js

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions src/core.js
Expand Up @@ -486,9 +486,10 @@ function QTip(target, options, id, attr)
if(('' + options.hide.event).indexOf('unfocus') > -1) {
targets.body.bind('mousedown'+namespace, function(event) {
var $target = $(event.target),
enabled = !tooltip.hasClass(disabled) && tooltip.is(':visible');
enabled = !tooltip.hasClass(disabled) && tooltip.is(':visible'),
isAncestor = $target.parents(selector).filter(tooltip[0]).length > 0;

if($target[0] !== tooltip[0] && $target.parents(selector).length === 0 &&
if($target[0] !== tooltip[0] && !isAncestor &&
!$target.closest(target).length && !$target.attr('disabled')
) {
self.hide(event);
Expand Down

0 comments on commit 14b8b7d

Please sign in to comment.