Zepto.js is the mobile-side lightweight JavaScript framework that implements most of the jquery APIs for Web development on mobile phones, and lightweight is the relative reduction of user access traffic
Zepto website Address
can be downloaded to GitHub Zepto source code is also for the module division
Zepto Thinking Guide diagram:
Commonly used return object condition:
1. return Zepto. Z (), returns an empty Zepto object:
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)
Common methods:
1, $ (selector,context?) passing in a selector returns a Zepto object
2, $ (function () {}) passed in a function, Dom ready to execute
3, $ (html,attrs?) passing in an HTML string, building an element, returning a or Zepto object
4, $ (DOM obj) incoming DOM object returns Zepto object
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 + 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-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 for use in $.Callbacks "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 is missing) for compatibility with IOS 3.x. |
Zepto.js-Lightweight mobile development JavaScript framework