强制 phonegap/cordova 应用在滚动时弹跳,即使是单个项目
Force phonegap/cordova app to bounce when scrolling even with a single item
这个问题与这个问题类似:Force uiscrollview to bounce scrolling even with a single item 但答案没有解决我的问题,因为我正在使用 cordova、HTML 5 和 Javascript 来构建我的应用程序。
我的应用使用iScroll 实现滚动时的弹跳效果,但是当内容适合整个屏幕时它不弹跳;不需要滚动时没有弹跳效果
帮忙?谢谢!
我似乎找不到让我这样做的替代方案,所以我修改了核心 iscroll.js (v5.1.1) 并在 iScroll.prototype.refresh
:[=12= 中添加了我自己的代码]
this.hasHorizontalScroll = this.options.scrollX && this.maxScrollX < 0;
this.hasVerticalScroll = this.options.scrollY && this.maxScrollY < 0;
//---- my code starts here
// set default value to 0 if the maxscrolly is greater than 0
//and set hasVerticalScroll to true (always true)
this.maxScrollY = (this.maxScrollY > 0) ? 0) : this.maxScrollY;
this.hasVerticalScroll = true;
//---- my code ends here
if ( !this.hasHorizontalScroll ) {
this.maxScrollX = 0;
this.scrollerWidth = this.wrapperWidth;
}
if ( !this.hasVerticalScroll ) {
this.maxScrollY = 0;
this.scrollerHeight = this.wrapperHeight;
}
*即使页面没有内容也会启用滚动弹跳效果
这个问题与这个问题类似:Force uiscrollview to bounce scrolling even with a single item 但答案没有解决我的问题,因为我正在使用 cordova、HTML 5 和 Javascript 来构建我的应用程序。
我的应用使用iScroll 实现滚动时的弹跳效果,但是当内容适合整个屏幕时它不弹跳;不需要滚动时没有弹跳效果
帮忙?谢谢!
我似乎找不到让我这样做的替代方案,所以我修改了核心 iscroll.js (v5.1.1) 并在 iScroll.prototype.refresh
:[=12= 中添加了我自己的代码]
this.hasHorizontalScroll = this.options.scrollX && this.maxScrollX < 0;
this.hasVerticalScroll = this.options.scrollY && this.maxScrollY < 0;
//---- my code starts here
// set default value to 0 if the maxscrolly is greater than 0
//and set hasVerticalScroll to true (always true)
this.maxScrollY = (this.maxScrollY > 0) ? 0) : this.maxScrollY;
this.hasVerticalScroll = true;
//---- my code ends here
if ( !this.hasHorizontalScroll ) {
this.maxScrollX = 0;
this.scrollerWidth = this.wrapperWidth;
}
if ( !this.hasVerticalScroll ) {
this.maxScrollY = 0;
this.scrollerHeight = this.wrapperHeight;
}
*即使页面没有内容也会启用滚动弹跳效果