我为iPhone创建了一个网页,其中有一个顶部和底部固定div。在它们之间,有一个可滚动的div。我正在使用“ -webkit-overflow-scrolling:触摸;” 启用快速滚动。
现在,如果滚动到达中间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
}
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句