估计是你使用的控件写的不完整问题,你或许可以换一个控件
至于 你想 解决橡皮筋效果问题 可以 借鉴
document.body.addEventListener('touchmove', function(evt) {
//In this case, the default behavior is scrolling the body, which
//would result in an overflow. Since we don't want that, we preventDefault.
if(!evt._isScroller) {
evt.preventDefault();
// return false
}
});
/*-----------------------------------------------------------------------------------------------------------------*/
function overscroll(el) {
el.addEventListener('touchstart', function() {
var top = el.scrollTop // 是指某个可滚动区块向下滚动的距离
, totalScroll = el.scrollHeight // 滚动大小,指的是包含滚动内容的元素大小(元素内容的总高度) 相当于可滚动的div的总体高度
, currentScroll = top + el.offsetHeight; // 偏移量,包含元素在屏幕上所用的所有可见空间(包括所有的内边距滚动条和边框大小,不包括外边距 相当于可滚动的div固定高度
//If we're at the top or the bottom of the containers
//scroll, push up or down one pixel.
//
//this prevents the scroll from "passing through" to
//the body.
if(top === 0) {
el.scrollTop = 1;
} else if(currentScroll === totalScroll) {
el.scrollTop = top - 1;
}
});
el.addEventListener('touchmove', function(evt) {
//if the content is actually scrollable, i.e. the content is long enough
//that scrolling can occur
if(el.offsetHeight < el.scrollHeight)
evt._isScroller = true;
});
}
function Alloverscroll(el) { //
el.addEventListener('touchmove', function(evt) {
evt._isScroller = true;
})
}