Skip to content

Instantly share code, notes, and snippets.

@hartct
Created October 30, 2011 00:45
Show Gist options
  • Save hartct/1325307 to your computer and use it in GitHub Desktop.
Save hartct/1325307 to your computer and use it in GitHub Desktop.
Patch for iUI.js to correct unnecessary scrolling to the top of page
--- iui.js
+++ iui.js
@@ -677,12 +677,12 @@ function orientChangeHandler()
switch(orientation)
{
case 0:
- setOrientation(portraitVal);
+ setOrientationAndScroll(portraitVal);
break;
case 90:
case -90:
- setOrientation(landscapeVal);
+ setOrientationAndScroll(landscapeVal);
break;
}
}
@@ -727,6 +727,11 @@ function setOrientation(orient)
iui.removeClass(document.body, portraitVal);
iui.removeClass(document.body, landscapeVal);
}
+}
+
+function setOrientationAndScroll(orient)
+{
+ setOrientation(orient);
setTimeout(scrollTo, 100, 0, 1);
}
@@ -844,7 +849,6 @@ function slide1(fromPage, toPage, backwards, axis, cb)
(backwards ? fromPage : toPage).style.top = "100%";
else
toPage.style.left = "100%";
-
scrollTo(0, 1);
toPage.setAttribute("selected", "true");
var percent = 100;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment