我尝试了一些不同的解决方案,在我的情况下似乎不起作用。
最后,我已经找到一种方法工作正常使用jQuery:
当你触摸了每一次应用-webkit-溢出滚动特性。
*起初我还-webkit-溢出滚动应用于:汽车时的TouchDown,禁用iOS的渲染。但它使页面闪烁。所以我放弃了它,然后令人惊讶地工作正常!
检查以下线,希望它有助于:
<!-- JQuery Functions-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript">
// Apply -webkit-overflow-scrolling in Every TouchEnd
$(document).on('click touchend', function(event) {
$("#TestDIV").css({"-webkit-overflow-scrolling":"touch"});
});
</script>
<!-- html Elements & Style -->
<div id="TestDIV">
<div class="Element"></div>
<div class="Element"></div>
<div class="Element"></div>
<div class="Element"></div>
<div class="Element"></div>
</div>
<style>
#TestDIV{
white-space: nowrap;
overflow-x: scroll;
-webkit-overflow-scrolling:touch;
}
#TestDIV .Element{
width:300px;
height:300px;
margin: 2px;
background-color: gray;
display: inline-block;
}
#TestDIV .Element:nth-child(odd){
background-color: whitesmoke;
}
</style>
我遇到对iOS6的一个类似的问题(问题的网页能正常工作的iOS5中)。通过应用-webkit-transform修复:translate3d(0,0,0);到已被切断的img标签,现在工作正常。 – codebox