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

Commit

Permalink
Removed iPad detecton in favour of manual offset calculation function
Browse files Browse the repository at this point in the history
  • Loading branch information
Craga89 committed Nov 9, 2010
1 parent 8990b90 commit e7ed890
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 94 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: Thu Nov 4 15:07:43 2010 +0000
* Date: Tue Nov 9 15:52:32 2010 +0000
*/

.ui-tooltip-accessible{
Expand Down
33 changes: 19 additions & 14 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: Thu Nov 4 15:07:43 2010 +0000
* Date: Tue Nov 9 15:52:32 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 @@ -178,6 +178,21 @@ function QTip(target, options, id)
return actual[i] !== undefined ? [option, actual[i] ] : [options, actual[0]];
}

function offset(e) {
var elem = e[0],
o = { left: 0, top: 0 };

if(elem.offsetParent) {
do {
offset.left += elem.offsetLeft;
offset.top += elem.offsetTop;
}
while(elem = elem.offsetParent);
}

return o;
}

function calculate(detail)
{
var tooltip = self.elements.tooltip,
Expand All @@ -201,7 +216,7 @@ function QTip(target, options, id)
break;

case 'position':
returned = tooltip.offset();
returned = offset(tooltip);
break;
}
if(show) { tooltip.removeClass(accessible); }
Expand Down Expand Up @@ -975,7 +990,7 @@ function QTip(target, options, id)
win = $(window),
adjust = {
left: function(posLeft) {
var targetLeft = target === 'mouse' ? event.pageX : target.offset().left,
var targetLeft = target === 'mouse' ? event.pageX : offset(target),
winScroll = win.scrollLeft(),
winWidth = win.width(),
myOffset = my.x === 'left' ? -elemWidth : my.x === 'right' ? elemWidth : elemWidth / 2,
Expand Down Expand Up @@ -1066,7 +1081,7 @@ function QTip(target, options, id)
targetWidth = target.outerWidth();
targetHeight = target.outerHeight();

position = target.offset();
position = offset(target);
if(posOptions.adjust.offset) {
do {
position.left -= offsetParent.offsetLeft - offsetParent.scrollLeft;
Expand Down Expand Up @@ -1415,16 +1430,6 @@ $.each({
}
}
});
},

/* Mobile Safari offset fix - See trac ticket: http://bugs.jquery.com/ticket/6446
*/
offset: parseFloat(((/CPU.+OS ([0-9_]{3}).*AppleWebkit.*Mobile/i.exec(navigator.userAgent)) || [0,'4_2'])[1].replace('_','.')) > 4 ? NULL : function() {
var result = $(this).Oldoffset();
result.top -= window.scrollY;
result.left -= window.scrollX;

return result;
}
},
function(name, func) {
Expand Down

0 comments on commit e7ed890

Please sign in to comment.