码迷,mamicode.com
首页 > 移动开发 > 详细

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

时间:2015-01-07 22:12:54      阅读:158      评论:0      收藏:0      [点我收藏+]

标签:javascript   web开发   手机   

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.     

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

标签:javascript   web开发   手机   

原文地址:http://blog.csdn.net/ejinxian/article/details/42501615

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!