为何选择Zepto.js的缘由:html
Zepto.js对 CSS 选择器的支持jquery
一、Zepto.js没有 .innerHeight() .outerWidth() 等四个方法。web
二、支持基本选择器ajax
ID选择器:$("#foo")性能
class选择器:$(".foo")设计
标签(元素)选择器:$("div")、$("p")。htm
通用选择器:$("*")。对象
三、支持层级选择器blog
后代选择器:$("foo bar")。事件
子元素选择器:$("foo > bar")。
相邻且靠后选择器:$("foo + bar")。
同辈且靠后选择器:$("foo ~ bar")。
四、不支持的选择器
基本伪类:
first、:not(selector) 、:even 、:odd 、:eq(index) 、:gt(index) 、:lang1.9+ 、:last 、:lt(index) 、:header、:animated 、:focus1.6+ 、:root1.9+ 、:target1.9+
内容伪类::contains(text) 、:empty、 :has(selector)、 :parent 。
可见性伪类::hidden 、:visible 。
属性选择器:[attribute!=value]。
表单伪类::input、 :text、 :password、 :radio、 :checkbox、 :submit、 :image、 :reset、 :button、 :file、 :hidden 。
表单对象属性::selected。
Touch 事件
tap —元素tap的时候触发。
singleTap and doubleTap — 这一对事件能够用来检测元素上的单击和双击。(若是你不须要检测单击、双击,使用 tap 代替)。
longTap — 当一个元素被按住超过750ms触发。
swipe, swipeLeft, swipeRight, swipeUp, swipeDown — 当元素被划过期触发。(可选择给定的方向)