透過 HTML 在行動網路瀏覽器中下拉重新整理。
當需要下拉螢幕以重新整理頁面以獲取最新更新時,可以使用 JavaScript、xhttprequests 和觸控事件來完成此操作。
下拉重新整理是對 AJAX 中 XHR 的觸發。它將新資料新增到我們想要新增到的元素。
可以使用像 iscroll 這樣的劫持 JavaScript 滾動機制來實現下拉重新整理。Twitter 正在使用 iscroll 拉取重新整理選項。
另一種方法是為overflow:scroll 元件建立一個重新整理處理程式。
提供的介面可以提供有關處理程式介面的想法 −
var PullToRefresh= function(callback, wrapper, instructionsText) {
//It creates dom elements and append them before content wrapper
// <div class="mainWrapper" style="overflow: scroll; height: 600px;">
<div class="pullToReloadWrapper"></div><div class = "contentWrapper"></div>
</div> is the markup.
// if main wrapper's height is > than content wrapper's
height, then change the main wrapper height to be the height of the content wrapper.
// scroll main wrapper.
// invoke initializeEvents() to inititalize the events
};
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP