Permalink
Browse files

Workaround for iPad's sticky slideOut.

Not much return for four hours work.
  • Loading branch information...
1 parent 71ec07d commit 40e4a3a506a12eae898338c8c72609e0a424b260 @joseph joseph committed Oct 10, 2011
Showing with 13 additions and 2 deletions.
  1. +10 −0 src/compat/env.js
  2. +3 −2 src/flippers/slider.js
View
10 src/compat/env.js
@@ -392,6 +392,16 @@ Monocle.Env = function () {
loadTestFrame(function (fr) {
result(fr.parentNode.scrollWidth > testFrameSize);
});
+ }],
+
+ // For some reason, WebKit on the iPad sometimes loses track of a page after
+ // slideOut -- it thinks it has an x-translation of 0, rather than -768 or
+ // whatever. So the page gets "stuck" there, until it is given a non-zero
+ // x-translation. The workaround is to set a non-zero duration on the jumpIn,
+ // which seems to force WebKit to recalculate the x of the page. Weird, yeah.
+ //
+ ["stickySlideOut", function () {
+ result(Monocle.Browser.on.iPad);
}]
];
View
5 src/flippers/slider.js
@@ -409,7 +409,8 @@ Monocle.Flippers.Slider = function (reader) {
function jumpIn(pageDiv, callback) {
- setX(pageDiv, 0, { duration: 0 }, callback);
+ opts = { duration: (Monocle.Browser.env.stickySlideOut ? 1 : 0) }
+ setX(pageDiv, 0, opts, callback);
}
@@ -441,7 +442,7 @@ Monocle.Flippers.Slider = function (reader) {
function slideOpts() {
- var opts = { timing: 'ease-in', duration: 300 }
+ var opts = { timing: 'ease-in', duration: 360 }
var now = (new Date()).getTime();
if (p.lastSlide && now - p.lastSlide < 1500) { opts.duration *= 0.5; }
p.lastSlide = now;

0 comments on commit 40e4a3a

Please sign in to comment.