我正在使用-webkit-overflow-scrolling:触摸iPad上的原生滚动功能.但是我遇到了一个很奇怪的问题:
我有一个有各种孩子的div.如果这些孩子足够大,可以创建滚动的需要,设备可以正确地滚动,动力和所有.但是,如果这个div不够大而不需要滚动,并且突然有元素插入其中并且现在需要滚动,则根本无法滚动元素.
我希望这不是太令人难以置信的混乱,但如果有人可以阐明在这种情况下该怎么做,那将是太棒了.关于这个属性的文档不多.
编辑:尝试了很多测试,现在看来它只是一个普遍断断续续的问题.对于我的整个网络应用程序,无论内容如何,每5次左右,滚动就会失败.
解决方法
我有同样的问题,似乎在添加新的DOM元素后分配CSS类似乎工作正常:
// your code to add a div to the DOM // the div contains a scrollable div with the content class setTimeout(function(){ // this is using JQuery div.find(".content").addClass("overflowScroll"); },1); // CSS class .overflowScroll { overflow: hidden; overflow-y: scroll; -webkit-overflow-scrolling: touch; } // The HTML for the div // I am adding a dynamic list to the content div // which should use the overflow scroll <div class="panel"> <div class="header"> </div> <div class="content"></div> </div>