javascript 如何在移动浏览器上显示滚动 div(或其他容器)?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8189601/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I display a scrolling div (or other container) on a mobile browser?
提问by IronicMuffin
I am currently writing a Terms and Conditions page for a wireless hotspot captive portal.
我目前正在为无线热点强制门户编写条款和条件页面。
I want to display the length Ts and Cs in a div and let the user scroll through them if they desire.
我想在 div 中显示长度 Ts 和 Cs,并让用户根据需要滚动浏览它们。
Easy enough for non-mobile browsers:
对于非移动浏览器来说足够简单:
<div id="terms" data-theme="a" style="overflow: scroll; height: 200px;">
<p>@Html.Raw(ViewBag.Terms)</p>
</div>
When I view the page on my mobile device, I get a div that feels like overflow: hidden
and no scrolling. I've read that two finger scrolling works on iOS devices, but I need Android to work as well.
当我在移动设备上查看页面时,我看到一个 div,感觉像是overflow: hidden
没有滚动。我读过两指滚动适用于 iOS 设备,但我也需要 Android 才能使用。
I'm using the newly released jQuery Mobileframework.
我正在使用新发布的jQuery Mobile框架。
An alternate solution that would be agreeable to me is some kind of scrolling dialog box I could pop, but it seems like I would still have the same problem. I'm open to ideas.
我认为可以接受的替代解决方案是我可以弹出的某种滚动对话框,但似乎我仍然会遇到同样的问题。我乐于接受各种想法。
Any thoughts? Thanks in advance for your help.
有什么想法吗?在此先感谢您的帮助。
回答by dSquared
回答by Phill Pafford
jQM Offer some experimental options:
jQM 提供一些实验选项:
I think you might look into:
我想你可能会研究: