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

Commit

Permalink
Fixed a regression in the positioning logic from previous commits
Browse files Browse the repository at this point in the history
  • Loading branch information
Craga89 committed Nov 30, 2010
1 parent 33af59e commit b0dcefd
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 64 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 Nov 30 21:45:57 2010 +0000
* Date: Tue Nov 30 21:47:27 2010 +0000
*/

.ui-tooltip-accessible{
Expand Down
16 changes: 9 additions & 7 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 Nov 30 21:45:57 2010 +0000
* Date: Tue Nov 30 21:47:27 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 @@ -1033,13 +1033,14 @@ function QTip(target, options, id)
atWidth = at.x === 'left' ? targetWidth : at.x === 'right' ? -targetWidth : -targetWidth / 2,
adjustX = -2 * posOptions.adjust.x,
overflowLeft = viewportScroll - posLeft,
overflowRight = posLeft + elemWidth - viewport.width - viewportScroll;
overflowRight = posLeft + elemWidth - viewport.width - viewportScroll,
offset = myWidth - adjustX - (my.precedance === 'y' ? atWidth : 0);

if(overflowLeft > 0) {
position.left -= myWidth - adjustX;
position.left -= offset;
}
else if(overflowRight > 0) {
position.left -= (my.x === 'center' ? -1 : 1) * (myWidth - adjustX);
position.left -= (my.x === 'center' ? -1 : 1) * offset;
}

return position.left - posLeft;
Expand All @@ -1050,13 +1051,14 @@ function QTip(target, options, id)
atHeight = at.y === 'top' ? targetHeight : at.y === 'bottom' ? -targetHeight : -targetHeight / 2,
adjustY = -2 * posOptions.adjust.y,
overflowTop = viewportScroll - posTop,
overflowBottom = posTop + elemHeight - viewport.height - viewportScroll;
overflowBottom = posTop + elemHeight - viewport.height - viewportScroll,
offset = myHeight - adjustY - (my.precedance === 'y' ? atHeight : 0);

if(overflowTop > 0) {
position.top -= myHeight - adjustY;
position.top -= offset;
}
else if(overflowBottom > 0) {
position.top -= (my.y === 'center' ? -1 : 1) * (myHeight - adjustY);
position.top -= (my.y === 'center' ? -1 : 1) * offset;
}

return position.top - posTop;
Expand Down

0 comments on commit b0dcefd

Please sign in to comment.