我为 iPhone 制作了一个网页,其中有一个顶部和一个底部固定的 div。在它们之间,有一个可滚动的 div。我正在使用“-webkit-overflow-scrolling: touch;”启用快速滚动。
现在,如果滚动到达中间 div 的顶部或底部,就会发生橡皮筋效果。这是我想要的效果!
但是,我该如何捕捉事件呢?这样我就可以使用 javascript/jquery 在橡皮筋效果上做一些有趣的事情。谢谢!
最佳答案
啊,原来可以这么简单
scrollable_div.on('touchmove', function () {
if (its_first_element.position().top > top_fixed_div.height()) {
// Rubber band effect happened, assuming the scrollable_div is vertically next to the top_fixed_div
}
});
关于javascript - 如何在 iPhone WebView 上检测可滚动 div 的橡皮筋事件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19599721/