Knowledge engineer full stack point summary --zepto Quick Start Tutorial

Zepto *
* Features:
1, volume 8KB
2, the framework for the mobile terminal
3, jquery syntax with most of the same functions as the core are $
4, the current full-featured framework around the smallest volume
* with jquery syntax similar to the
core: $
- as a function of
parameters:
. 1, function () {}
2, selector string
3, html tag string
. 3, the DOM code
- used as an object
method;
. 1, each $ ().
2, $ TRIM (. )
3, $ ajax () $ .get () $ .post ().
4, $ isArray ().
jquery object / zepto objects
concept: call return is $ jquery object / zepto objects artificial array (sometimes only one element )

* different zepto with jQuery the API
* attr with prop
jQuery: inherent properties of the label, Boolean attribute <prop>
custom properties tab, Boolean attribute in the tag body is not defined when <attr> with attr Boolean property and
zepto : attr get the same Boolean property.

* DOM operation
configuration objects:
jQuery use different configuration objects to add id, class. . .
--- zepto configuration object structure can be used, the separation pattern, and easy to manage

* offset () ---- target element used to obtain the object with respect to the offset of the viewport
jQuery: Top, left

zeptop: Top, left, width , height (content, padding, border)

* width (), height ()
jQuery:
. 1, width (), height () Gets the value of content of the content area, no units
2, .css acquired value of the content the content area, there are units PX
. 3, innerHeight, () Content, padding no units
innerHeight () content, padding border no units
Zepto:
. 1, width (), height () Content acquisition, padding, border
2, no innerHeight, (), innerHeight, ()
. 3, .css ()

* event delegate
principle: to bind events to the parent element using the principle of bubbling / ancestor who, event.target point of sub-elements
Zepto:
1, commissioned by the same parent element body
2, the same world
3, operatively associated, the operation corresponding element / type
4, sequence
5, the operation of the associated class who is who triggered

* each
jquery: can traverse the array, the object can not traverse the string / json objects / json array
zepto: can traverse the array, the object, the string

* hidden element width and height
jquery: obtaining energy
zepto: not wide, high

Zepto the Event Touch
* TAP click event
* singleTap () click event
* doubleTap () Double-click the event
* longTap () press event - continuous action of 750ms
* slip events (the default behavior of the browser's page --- Touch-action ---)
1, swipe slip events continuous slide in the same direction as the slide was 30px, otherwise click
2, longTap press event finger on the target object in a row overshadows 750ms press count, or count clicks

Guess you like

Origin www.cnblogs.com/kathyhong/p/11243610.html