问题描述
因此,我们正在为一个客户端构建这个Web应用程序,它在iOS7的Safari中工作完美。但是当我们在iOS8中检查应用程序时,它有一些巨大的错误。
So we are building this web app for a client which worked perfectly on iOS7 in Safari. But when we checked the app out in iOS8 it had a some huge bugs.
- 如果用户打开边栏并关闭边栏,则
< section style =overlay -y:scroll;>< / section>
消失(重叠部分)。 - 某些按钮因为任何原因停止工作。 (
< a href => Lala< / a>
)
- If a user opens the sidebar and closes it, content that is in a
<section style="overlay-y: scroll;"></section>
disappears ( the overlaid part ). - Some buttons stopped working for any reason. (
<a href="">Lala</a>
)
当我们从容器(包含所有内容的div)中删除 -webkit-overflow-scrolling:touch;
时,一切都像以前一样正常工作...
When we remove -webkit-overflow-scrolling: touch;
from the container ( the div that holds all the content ) everything works flawlessly like it used to...
有什么想法吗?
推荐答案
有同样的问题!到目前为止,我找不到一个真正的解决方案,但有一个不太理想的解决方法:
I'm having this same issue! So far I can't find a true solution, but there is a less-than-ideal workaround:
假设#container有 -webkit -overflow-scrolling:touch
属性设置,这个jQuery应该可以帮助你:
Assuming #container has the -webkit-overflow-scrolling: touch
property set, this jQuery should help you out:
$('#container').css('-webkit-overflow-scrolling','auto');
或对于javascript(未测试):
Or for javascript (untested):
document.getElementById('container').style.webkitOverflowScrolling = 'auto';
这将禁用页面上平滑的轮盘式滚动。所以这不是理想的,但你的页面应该正确滚动现在。
This will disable the smooth roulette-style scrolling on the page. So it's not ideal, but your page should scroll correctly now.
进一步的研究发现,方式来解决这个问题,同时保持平滑的触摸滚动工作。假设你有 -webkit-overflow-scrolling:touch
在css中的某处,你可以在你的JS中切换。我不知道你有什么显示/隐藏菜单,但希望你可以利用这个。
Some further research led to our discovery of a more hacky way to resolve this while keeping the smooth touch scrolling working. Assuming you have -webkit-overflow-scrolling: touch
somewhere in the css, you can "toggle" it within your JS. I'm not sure what you have that shows/hides the menu, but hopefully you can utilize this.
function toggleMenu(){
$('#container').css('-webkit-overflow-scrolling','auto');
//...Existing code
setTimeout(function() {
$('#container').css('-webkit-overflow-scrolling','touch');
},500);
}
这对于没有setTimeout的我没有用。希望这可以帮助你或别人出去。
This didn't work for me without the setTimeout. Hope this can help you or someone else out.
这篇关于iOS8 Safari -webkit-overflow-scrolling:touch;问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!