Skip to content

Commit

Permalink
dateinput, tooltip and validator error messages now position correctl…
Browse files Browse the repository at this point in the history
…y on iPad. native jQuery offset() method returns incorrect value on iPad.
  • Loading branch information
tipiirai committed Sep 21, 2010
1 parent b780ebb commit 5926ae9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/dateinput/dateinput.js
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,11 @@
// show calendar
var pos = input.offset();

// iPad position fix
if (/iPad/i.test(navigator.userAgent)) {
pos.top -= $(window).scrollTop();
}

root.css({
top: pos.top + input.outerHeight({margins: true}) + conf.offset[0],
left: pos.left + conf.offset[1]
Expand Down
5 changes: 5 additions & 0 deletions src/tooltip/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@
top -= tip.outerHeight() - conf.offset[0];
left += trigger.outerWidth() + conf.offset[1];

// iPad position fix
if (/iPad/i.test(navigator.userAgent)) {
top -= $(window).scrollTop();
}

// adjust Y
var height = tip.outerHeight() + trigger.outerHeight();
if (pos == 'center') { top += height / 2; }
Expand Down
6 changes: 6 additions & 0 deletions src/validator/validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@
top -= el.outerHeight() - conf.offset[0];
left += trigger.outerWidth() + conf.offset[1];


// iPad position fix
if (/iPad/i.test(navigator.userAgent)) {
top -= $(window).scrollTop();
}

// adjust Y
var height = el.outerHeight() + trigger.outerHeight();
if (y == 'center') { top += height / 2; }
Expand Down

0 comments on commit 5926ae9

Please sign in to comment.