Skip to content

Commit

Permalink
Workaround for iPad's sticky slideOut.
Browse files Browse the repository at this point in the history
Not much return for four hours work.
  • Loading branch information
joseph committed Oct 14, 2011
1 parent 71ec07d commit 40e4a3a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/compat/env.js
Expand Up @@ -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);
}]

];
Expand Down
5 changes: 3 additions & 2 deletions src/flippers/slider.js
Expand Up @@ -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);
}


Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 40e4a3a

Please sign in to comment.