禁用iOS Overscroll,但允许正文滚动 [英] Disable iOS Overscroll but allow body scrolling
本文介绍了禁用iOS Overscroll,但允许正文滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
$(document)我想在webapp中禁用iOS overscroll,但仍然允许滚动主体。 ).on('touchmove',function(e){
e.preventDefault();
});
完全禁用滚动功能(正如人们所期望的那样)。
有没有办法做我想做的事?
https://stackoverflow.com/questions/10238084/ios-safari-how-to-disable-overscroll-but-allow-scrollable-divs-to-scroll-norma\">同一问题。这应该有助于你:pre $
//禁用所有滚动/视口移动但滚动div
$('body' ).on('touchmove',function(e){
if(!$('。scrollable')。has($(e.target))。length)e.preventDefault();
});
I would like to disable the iOS overscroll in a webapp but still allow the body to be scrolled.
$(document).on('touchmove', function(e) {
e.preventDefault();
});
disables scrolling altogether (as one would expect).
Is there a way to do what I want to do?
解决方案
I had pretty much the same issue. This should help you:
// Disable overscroll / viewport moving on everything but scrollable divs
$('body').on('touchmove', function (e) {
if (!$('.scrollable').has($(e.target)).length) e.preventDefault();
});
这篇关于禁用iOS Overscroll,但允许正文滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文