Scroller

这个插件同意你创建一个可滚动区域。我们使用的JavaScript滚轮,除非该设备支持 - WebKit的溢出卷轴:触摸。它有很多修复Android版<3和iOS原生的滚动。

创建:

2
$(selector).scroller({})//create
$(selector).scroller()//get
the scroller object

属性:

Attributes

1
2
3
4
5
6
7
8
9
10
11
scrollbars                  
(bool) ID of DOM elemenet
forthe
popup container
verticalScroll              
(bool) 同意vertical scrolling
horizontalScroll            
(bool) 同意horizontal scrolling
useJsScroll                 
(bool) 是否同意 JavaScript scroller
lockBounce                  
(bool) Prevent the rubber band effect
autoEnable                  
(bool) 自己主动启用滚动栏
refresh                     
(bool) 上拉刷新
infinite                    
(bool) 启用无限滚动
initScrollProgress          
(bool) Dispatch progress on touch move
vScrollCSS                  
(string) 垂直滚动栏
hScrollCSS                  
(string) 水平滚动栏

方法

1
2
3
4
5
6
7
8
9
10
11
enable()                    
启用滚动栏
disable()                   
禁用滚动栏
scrollToBottom(time)        
滚动到内容的底部
scrollToTop(time)           
滚动到内容顶部
scrollTo(obj,time)          
to X / Y 坐标
scrollBy(obj,time)          
by X / Y 坐标
addPullToRefresh()          
启用下拉刷新的滚动栏
setRefreshContent(string)   
设置了下拉刷新内容的文字
addInfinite()               addInfinite事件
clearInfinite()             
Clear inifinite-scroll-end event
scrollToItem(DOMNode,time)  
滚动到屏幕上的特定元素

事件

Events must be registered on the scroller using $.bind()

1
2
3
4
5
6
7
8
9
10
11
12
13
14
//scroller
object events
scrollstart                 
Scrolling started
scroll                      
Scrolling progress
scrollend                   
Scrolling stopped
 
//pull
to refresh
refresh-trigger             
Pull to refresh scroll started
refresh-release             
Event when pull to refresh is has happened
refresh-cancel              
User cancelled pull to refresh by scrolling
refresh-finish              
Pull to refresh has finished and hidden
 
//infinite
scroll
infinite-scroll             
User scrolled to the bottom of the content
infinite-scroll-end         
User finished scrolling

CSS/Customize

Below is an example used by App Framework's iOS7 theme to customize the look and feel of the popup

1
2
3
4
5
6
7
8
9
.scrollBar
{
    position:
absolute ;
    width:
5px !important;
    height:
20px !important;
    border-radius:
2px !important;
    border:
1px solid black !important;
    background:
red !important;
    opacity:
0 !important;
}

Examples

在HTML 中加入

1
||div
id=
"scroll"style='width:100%;height:200;'></div>

js中创建

1
2
3
4
5
varmyScroller=$("#scroll").scroller({
   verticalScroll:true,
   horizontalScroll:false,
   autoEnable:true
})

调用方法

1
myScroller.addPullToRefresh();

从缓存中获取滚动栏

1
varmyScroller=$("#scroll").scroller();//no
parameters

Pull to refresh

以下是怎样结合事件和运行下拉刷新的样例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
myScroller.addPullToRefresh();
 
//User
is dragging the page down exposing the pull to refresh message.
$.bind(myScroller,"refresh-trigger",function()
{
    console.log("Refresh
trigger"
);
});
 
//Here
we listen for the user to pull the page down and then let go to start the pull to refresh callbacks.
varhideClose;
$.bind(myScroller,"refresh-release",function()
{
    varthat
=
this;
    console.log("Refresh
release"
);
    clearTimeout(hideClose);
    //For
the demo, we set a timeout of 5 seconds to show how to hide it asynchronously
    hideClose
= setTimeout(
function()
{
        console.log("hiding
manually refresh"
);
        that.hideRefresh();
    },
5000);
    returnfalse;//tells
it to not auto-cancel the refresh
});
 
//This
event is triggered when the user has scrolled past and the pull to refresh block is no longer available
$.bind(myScroller,"refresh-cancel",function()
{
    clearTimeout(hideClose);
    console.log("cancelled");
});

infinite scrolling

The following shows how to implement infinite scrolling.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
myScroller.addInfinite();
 
//Bind
the infinite scroll event
$.bind(myScroller,"infinite-scroll",function()
{
    varself
=
this;
    console.log("infinite
triggered"
);
    //Append
text at the bottom
    $(this.el).append("
 
<div
id="
infinite"
style="
border:2px
solid black;margin-top:10px;width:100%;height:20px
">Fetching
content...</div>
 
");
    //Register
for the infinite-scroll-end - this is so we do not get it multiple times, or a false report while infinite-scroll is being triggered;
    $.bind(myScroller,"infinite-scroll-end",function()
{
        //unbind
the event since we are handling it
        $.unbind(myScroller,"infinite-scroll-end");
        self.scrollToBottom();
        //Example
to show how it could work asynchronously
        setTimeout(function()
{
            $(self.el).find("#infinite").remove();
            //We
must call clearInfinite() when we are done to reset internal variables;
            self.clearInfinite();
            $(self.el).append("
 
<div>This
was loaded via inifinite scroll<br>More Content</div>
 
");
            self.scrollToBottom();
        },
3000);
    });
});

有什么问题能够联系我

官网链接:http://app-framework-software.intel.com/api.php#scroller

欢迎增加学习交流群:333492644

app-framework学习--Scroller的更多相关文章

  1. jqMobi(App Framework)入门学习(一)

    jqMobi(App Framework)入门学习(一) 1. 什么是jqMobi? jqMobi是由appMobi针对HTML5浏览器和移动设备开发的javascript框架.是个极其高速的查询选择 ...

  2. [AFUI]App Framework

    ---------------------------------------------------------------------------------------------------- ...

  3. Entity Framework学习笔记

    原文地址:http://www.cnblogs.com/frankofgdc/p/3600090.html Entity Framework学习笔记——错误汇总   之前的小项目做完了,到了总结经验和 ...

  4. Android学习Scroller(五)——具体解释Scroller调用过程以及View的重绘

    PS: 该篇博客已经deprecated,不再维护.详情请參见  站在源代码的肩膀上全解Scroller工作机制  http://blog.csdn.net/lfdfhl/article/detail ...

  5. Entity Framework 学习

    Entity Framework 学习初级篇1--EF基本概况 Entity Framework 学习初级篇2--ObjectContext.ObjectQuery.ObjectStateEntry. ...

  6. [Learn AF3]第一章 如何使用App Framework 3.0 构造应用程序

    af3的变化非常大.参见[译]Intel App Framework 3.0的变化 一.应用需要引用的js脚本: af3中不在自己实现dom选择器,而是选择基于jquey或兼容jquery的库如zep ...

  7. [译]Intel App Framework 3.0的变化

    App Framework 3.0 原文 IAN M. (Intel) 发布于 2015-02-11  05:24 我们高兴地宣布App Framework 的新版本3.0发布了.你可以获得最新的代码 ...

  8. Android FrameWork学习(二)Android系统源码调试

    通过上一篇 Android FrameWork学习(一)Android 7.0系统源码下载\编译 我们了解了如何进行系统源码的下载和编译工作. 为了更进一步地学习跟研究 Android 系统源码,今天 ...

  9. App Framework $.ui.loadContent 参数解释

    在使用 app Framework 的 $.ui.loadContent(target,newTab,goBack,transition);时 对 newTab goback两个参数一直不得其解.通过 ...

随机推荐

  1. spring配置:context:property-placeholder 读取配置文件信息 在配置文件中使用el表达式填充值

    spring将properties文件读取后在配置文件中直接将对象的配置信息填充到bean中的变量里. 原本使用PropertyPlaceholderConfigurer类进行文件信息配置.Prope ...

  2. redhat6.8服务器版本 yum 源的配置

    阿里云的源地址: http://mirrors.aliyun.com/ 打开后点击帮助: 有如下提示: 不过不能直接使用这个源,因为自己使用的是服务器版本,要修改一个变量,先将源文件下载下来. wge ...

  3. sama5d3 环境检测 adc测试

    #include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <string.h># ...

  4. PHP——转义字符

    链接:百度-转义字符 http://baike.baidu.com/link?url=obfdOqATx4TO0Ev_kFnPz37wwW3SDhFPsvNobVTidhFuCn2zK5VmCuW1L ...

  5. 深入分析 iBATIS 框架之系统架构与映射原理

    iBATIS 框架主要的类层次结构 总体来说 iBATIS 的系统结构还是比较简单的,它主要完成两件事情: 根据 JDBC 规范建立与数据库的连接: 通过反射打通 Java 对象与数据库参数交互之间相 ...

  6. SQL Server 数据库同步,订阅、发布、复制、跨服务器

    随便说两句 折腾了一周,也算把数据库同步弄好了.首先局域网内搭建好,进行各种测试,弄的时候各种问题,弄好以后感觉还是挺简单的.本地测试好了,又在服务器进行测试,主要的难点就是跨网段同步,最后也解决了, ...

  7. Redis list 之增删改查

    一.增加 1.lpush [lpush key valus...]  类似于压栈操作,将元素放入头部 127.0.0.1:6379> lpush plist ch0 ch1 ch2 (integ ...

  8. 004杰信-关于formSubmit('factorycreate.action','_self')路径的疑惑

    本文材料来源于传智播客,在此说明. 整个项目结构:

  9. 第二百七十一节,Tornado框架-CSRF防止跨站post请求伪造

    Tornado框架-CSRF防止跨站post请求伪造 CSRF是什么 CSRF是用来在post请求时做请求验证的,防止跨站post请求伪造 当用户访问一个表单页面时,会自动在表单添加一个隐藏的inpu ...

  10. 开源 java CMS - FreeCMS2.3 移动app生成栏目数据

    原文地址:http://javaz.cn/site/javaz/site_study/info/2015/28230.html​ 项目地址:http://www.freeteam.cn/ 生成栏目数据 ...