Is there a way to determine the position of the "viewport" in mobile safari on a web page? Like x, y, w, h pixel positions of what the phone is currently seeing on the page?
+1
A:
In javascript (on Mobile Safari) you can use window.pageXOffset and window.pageYOffset to get the x and y offsets, window.innerWidth and window.innerHeight to get w and h.
Jeethu
2010-05-21 15:11:13
This fails if you reload the page and the page is already scrolled down. Reports "0".
Typeoneerror
2010-09-07 02:04:07
@typeoneerror: I got a similar problem with the "already scrolling down": http://stackoverflow.com/questions/3654024/mobilesafari-auto-scroll-pan-to-specific-position-on-page-after-reloadPlease let me know if you find any solution for the problem.
JanD
2010-09-07 12:23:20