簡體   English   中英

滾動單個項目時強制phonegap / cordova應用反彈

[英]Force phonegap/cordova app to bounce when scrolling even with a single item

這個問題類似於這個問題: 即使使用單個項目 ,也強制uiscrollview彈跳滾動,但是由於我使用Cordova,HTML 5和Javascript構建我的應用程序,因此答案並沒有解決我的問題。

我的應用程序使用iScroll在滾動時實現反彈效果,但是當內容適合整個屏幕時它不會反彈。 當不需要滾動時,它沒有反彈效果。

救命? 謝謝!

我似乎找不到讓我做到這一點的替代方法,因此我修改了核心iscroll.js(v5.1.1),並在iScroll.prototype.refresh添加了自己的代碼:

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;
}

*即使頁面沒有內容,這也會啟用滾動跳動效果。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM