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

Commit

Permalink
Updated screen adjustment to prevent overlapping of the content when …
Browse files Browse the repository at this point in the history
…adjusting
  • Loading branch information
Craga89 committed Aug 26, 2010
1 parent 75187fe commit c44ec1b
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 61 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: Wed Aug 25 19:13:02 2010 +0100
* Date: Wed Aug 25 22:13:40 2010 +0100
*/

.ui-tooltip-accessible{
Expand Down
10 changes: 6 additions & 4 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: Wed Aug 25 19:13:02 2010 +0100
* Date: Wed Aug 25 22:13:40 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 @@ -865,15 +865,16 @@ function QTip(target, options, id)
myOffset = my.x === 'left' ? -elemWidth : my.x === 'right' ? elemWidth : elemWidth / 2,
atOffset = at.x === 'left' ? targetWidth : at.x === 'right' ? -targetWidth : targetWidth / 2,
adjustX = -2 * posOptions.adjust.x,
adjustWidth = my.x !== at.x && at.x !== 'center' ? targetWidth : 0,
newOffset = atOffset + myOffset + adjustX,
overflowLeft = winScroll - posLeft,
overflowRight = posLeft + elemWidth - winWidth - winScroll;

if(overflowLeft > 0 && !(posLeft >= targetLeft && posLeft < targetLeft + targetWidth)) {
position.left += newOffset - atOffset;
position.left += newOffset - atOffset + adjustWidth;
}
else if(overflowRight > 0 && posLeft + elemWidth > targetLeft) {
position.left += my.x === 'center' ? -newOffset + atOffset : newOffset - atOffset;
position.left += (my.x === 'center' ? -1 : 1) * (newOffset - atOffset - adjustWidth);
}

return position.left - posLeft;
Expand All @@ -884,6 +885,7 @@ function QTip(target, options, id)
myOffset = my.y === 'top' ? -elemHeight : my.y === 'bottom' ? elemHeight : -elemHeight / 2,
atOffset = at.y === 'top' ? targetHeight : at.y === 'bottom' ? -targetHeight : 0,
adjustY = -2 * posOptions.adjust.y,
adjustHeight = my.y !== at.y && at.y !== 'center' ? targetHeight : 0,
newOffset = atOffset + myOffset + adjustY,
overflowTop = winScroll - posTop,
overflowBottom = posTop + elemHeight - winHeight - winScroll;
Expand All @@ -892,7 +894,7 @@ function QTip(target, options, id)
position.top += my.y === 'center' ? -newOffset + atOffset : newOffset;
}
else if(overflowBottom > 0) {
position.top += newOffset - atOffset;
position.top += newOffset - atOffset - adjustHeight;
}

return position.top - posTop;
Expand Down

0 comments on commit c44ec1b

Please sign in to comment.