get viewport position in javascript in iphone safari


get viewport position in javascript in iphone safari



I'm trying to prevent element from scrolling in safari on iphone. I've tried solutions mentioned here: http://stackoverflow.com/questions/777621/iphone-safari-scroll-a-list-inside-a-html-container But my list is large and it doesn't work so smoothly.

What I have in mind is to detect onscroll event and reposition the element, so it's in the boundaries of viewport.

But I can't find way to detect coordinates of the viewport. Can anybody help with this?

Thanks.


UIWebView scrollBy replacement

1:

Hide the tab bar when displaying the ABPeoplePickerNavigationController?
document.addEventListener( 	'touchmove', 	function touchMove(event) { 		event.preventDefault() 	}, 	false ); 
Draw a shadow behind UIWebViewiPhone subview design (UIView vs UIViewController)

2:

Inability to delete table cells after a certain point
Take a look at iScroll. Is there an Cocoa or Objective C api for Java? If is doesn't did what you want, you must use the implementation for reference. Protocols with optional properties? I think the trick so to did both event.preventDefault() and event.stopPropagation() to keep mobile safari from responding to the touch events.. How to determine where this memory leak is coming from?
iScroll was born for the reason this mobile webkit (on iPhone, iPod, Android and Pre) does not provide a native way to scroll content inside a fixed width/height element. This unfortunate position prevents any web-app to have a position:complete header and/or footer and a scrolling central area for contents..

3:

var viewport_x = window.pageXOffset; var viewport_y = window.pageYOffset; 


56 out of 100 based on 51 user ratings 976 reviews