zepto.js - 轻量级的移动开发JavaScript框架

Zepto.js  是移动端轻量级的JavaScript框架,实现JQuery的大部分API,针对手机上web开发,轻量级的是相对性的减少用户访问流量

Zepto官网 地址  

可以到 github上下载zepto的源码也是进行模块划分的

技术分享

Zepto 思维导向图:

技术分享


常用返回对象情况:

1、return zepto.Z(),返回一个空的zepto对象:

2、return $(context).find(selector) 

3、return $(document).ready(selector)

4、if (zepto.isZ(selector)) return selector

5、return $(context).find(selector)

6、return zepto.Z(dom, selector)


常用方法:

1、$(selector,context?) 传入一个选择器返回一个zepto对象

2、$(function(){}) 传入一个函数,dom ready时执行

3、$(html,attrs?) 传入一个html字符串,构建元素,返回一个或zepto对象

4、$(dom obj)传入dom对象返回zepto对象


Zepto modules

module default description
zepto ? Core module; contains most methods
event ? Event handling via on() & off()
ajax ? XMLHttpRequest and JSONP functionality
form ? Serialize & submit web forms
ie ? Add support for Internet Explorer 10+ on desktop and Windows Phone 8.
detect   Provides $.os and $.browser information
fx   The animate() method
fx_methods   Animated show, hide, toggle, and fade*() methods.
assets   Experimental support for cleaning up iOS memory after removing image elements from the DOM.
data   A full-blown data() method, capable of storing arbitrary objects in memory.
deferred   Provides $.Deferred promises API. Depends on the "callbacks" module.
When included, $.ajax() supports a promise interface for chaining callbacks.
callbacks   Provides $.Callbacks for use in "deferred" module.
selector   Experimental jQuery CSS extensions support for functionality such as $(‘div:first‘) and el.is(‘:visible‘).
touch   Fires tap– and swipe–related events on touch devices. This works with both `touch` (iOS, Android) and `pointer` events (Windows Phone).
gesture   Fires pinch gesture events on touch devices
stack   Provides andSelf & end() chaining methods
ios3   String.prototype.trim and Array.prototype.reduce methods (if they are missing) for compatibility with iOS 3.x.     

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。