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

Commit

Permalink
Tooltips contained within relative/absolute containers now position p…
Browse files Browse the repository at this point in the history
…roperly with position.adjust.offset set to true
  • Loading branch information
Craga89 committed Aug 16, 2010
1 parent 1fe4a32 commit 1ac389f
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 73 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: Tue Aug 10 19:44:01 2010 +0100
* Date: Tue Aug 10 23:51:21 2010 +0100
*/

.ui-tooltip-accessible{
Expand Down
13 changes: 5 additions & 8 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 Aug 10 19:44:01 2010 +0100
* Date: Tue Aug 10 23:51:21 2010 +0100
*/

"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 @@ -173,10 +173,6 @@ function QTip(target, options, id)
width: tooltip.outerWidth()
};
break;

case 'offsetParent':
returned = tooltip.offsetParent();
break;

case 'position':
returned = tooltip.offset();
Expand Down Expand Up @@ -845,6 +841,7 @@ function QTip(target, options, id)
at = posOptions.at,
elemWidth = self.elements.tooltip.width(),
elemHeight = self.elements.tooltip.height(),
offsetParent = posOptions.container,
targetWidth = 0,
targetHeight = 0,
position = { left: 0, top: 0 },
Expand Down Expand Up @@ -933,14 +930,14 @@ function QTip(target, options, id)
targetWidth = target.outerWidth();
targetHeight = target.outerHeight();

if(!posOptions.adjust.offset || calculate('offsetParent')[0] === document.body) {
if(!posOptions.adjust.offset || offsetParent[0] === document.body) {
position = target.offset();
}
else {
// Account for offset parent and it's scroll positions
position = target.position();
position.top += target.offsetParent().scrollTop();
position.left += target.offsetParent().scrollLeft();
position.top += offsetParent.scrollTop() - offsetParent.offset().top;
position.left += offsetParent.scrollLeft() - offsetParent.offset().left;
}
}

Expand Down

0 comments on commit 1ac389f

Please sign in to comment.