Android浏览器的bug? DIV溢出滚动 [英] Android browser bug? div overflow scrolling
问题描述
您可以做一个div的溢出内容滚动在Android浏览器?
Can you make the overflow content of a div scrollable in the Android browser?
这是滚动在所有其他现代浏览器。
It is scrollable in all other modern browsers.
在iOS的是滚动的 - 但它并没有显示滚动条 - 但它通过拖动可滚动
In iOS it is scrollable - however it does not show scrollbars - but it is scrollable via dragging.
一个简单的例子: <一href="http://jsfiddle.net/KPuW5/1/embedded/result/">http://jsfiddle.net/KPuW5/1/embedded/result/
这会不会很快解决吗?
Will this be fixed soon?
推荐答案
Android的3.0和更高版本都支持溢出:滚动
,在&LT; 3.0又是另一回事。你可能有但是polyfills像iScroll,这并付出了代价取得了一些成功。这是很难实现的网站上有复杂的布局,你需要调用的方法,每次在您的网站的内容发生更改。内存使用也是一个问题:在已经动力不足的设备的性能可能会滞后,因为这类polyfills的
Android 3.0 and higher have support for overflow:scroll
, on < 3.0 it's another story. You might have some success with polyfills like iScroll, however that does come at a cost. It's difficult to implement on sites with complex layouts, and you need to a call a method everytime the content on your site changes. Memory use is also an issue: on already underpowered devices performance may lag because of these kinds of polyfills.
我会建议不同的方法:使用Modernizr的检测支持溢出滚动,一类添加到您的 HTML
标记,并用它来重写你的CSS使页面滚动正常的,而不是在一个盒子里。
I would recommend a different approach: use Modernizr to detect support for overflow scrolling , add a class to your html
tag and use that to rewrite your CSS so that pages scroll 'normally' instead of in a box.
/* For browsers that support overflow scrolling */
#div {
height: 400px;
overflow: auto;
}
/* And for browsers that don't */
html.no-overflowscrolling #div {
height: auto;
}
这篇关于Android浏览器的bug? DIV溢出滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!