webview without scroll
Any way to prevent any scrolling within webview. I have an html page that is sized perfect; however, you are still able to scroll just a bit up and down (before it bounces back into place). Any thoughts?
7 Answers
-
You could disable the bouncing effect with
disableBounce = true;
If you try to disable the touchmove or touched events you wont be able to scroll on the map anymore.
-
This is for anyone that is stumbling across this very notion, but the problem isn't with any of the Titanium elements or the native webview, but rather the HTML that you're loading in.
The solution is to simply set any possible padding and margins for the body and html tags to zero, as such:
webview.setHtml("<html><head><style> html, body { margin: 0px; padding: 0px; } </style></head><body><script> alert('I am in a WebView'); </script></body></html>');
Hope that helps!
-
Here is the solution.
-
You should use preventDefault for "touchmove" and (maybe also) "touchend" events in your html page.
-
@Glenn, could you please be more specific as to where to use disableBounce? I have not been able to find any information on this technique.
-
When I added:
touchEnabled:false
to the webview it worked but obviously any links, etc will not work, as touch is disabled.
Hope that helps a little?
-
Use this, in the HTML:
<meta name="viewport" content="width=320,initial-scale=1,maximum-scale=1.0,user-scalable=0" />