
当需要下拉屏幕以刷新页面以获取最新更新时,可以借助JavaScript、xhttprequests和触摸事件来实现。
下拉刷新是AJAX中XHR的触发器。它向我们想要的元素添加新数据。
可以通过劫持JavaScript滚动机制(如iscroll)来实现下拉刷新。Twitter正在使用iscroll来实现下拉刷新选项。
AJAX即“Asynchronous Javascript And XML”(异步JavaScript和XML),是指一种创建交互式网页应用的网页开发技术。它不是新的编程语言,而是一种使用现有标准的新方法,最大的优点是在不重新加载整个页面的情况下,可以与服务器交换数据并更新部分网页内容,不需要任何浏览器插件,但需要用户允许JavaScript在浏览器上执行。《php中级教程之ajax技术》带你快速
2114
另一种方式是为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
};以上就是在HTML中的移动网页浏览器上下拉刷新的详细内容,更多请关注php中文网其它相关文章!
HTML怎么学习?HTML怎么入门?HTML在哪学?HTML怎么学才快?不用担心,这里为大家提供了HTML速学教程(入门课程),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号