輕量級的移動開發JavaScript框架:zepto.js
Zepto.js 是移動端輕量級的JavaScript框架,實現JQuery的大部分API,針對手機上web開發,輕量級的是相對性的減少用戶訪問流量
可以到 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 viaon()&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$.osand$.browserinformation | |
| fx | Theanimate()method | |
| fx_methods | Animatedshow,hide,toggle, andfade*()methods. | |
| assets | Experimental support for cleaning up iOS memory after removing image elements from the DOM. | |
| data | A full-blowndata()method, capable of storing arbitrary objects in memory. | |
| deferred | Provides$.Deferredpromises API. Depends on the "callbacks" module. When included, $.ajax() supports a promise interface for chaining callbacks. |
|
| callbacks | Provides$.Callbacksfor use in "deferred" module. | |
| selector | Experimental jQuery CSS extensions support for functionality such as$('div:first')andel.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 | ProvidesandSelf&end()chaining methods | |
| ios3 | String.prototype.trim and Array.prototype.reduce methods (if they are missing) for compatibility with iOS 3.x. |
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!