Learning Zepto.js, reference: http://www.zeptojs.cn/
Like jquery, its choice symbol is $;
The first contact is
$. () Select
$ (selector, [context]) $ (<zepto collection>) $ (<dom nodes>) collection $ ( htmlstring) collection Zepto ( Function ($) {...})
$(' div ') //=> all DIV elements on the page$(' #foo ') //=> element with ID "foo"//Generate elements from HTML$("<p>Hello</p>") //=> the orphaned P element//Execute function when the page was readyZepto(function($){ Alert(' ready to zepto! ')})
$.each iterating over arrays and objects$. each([' A ', ' B ', ' C '], function(Index, Item){ Console.Log(' Item%d is:%s ', Index, Item)})var Hash = { name: ' Zepto.js ', size: ' Micro ' }$. each(Hash, function(Key, value){ Console.Log('%s:%s ', Key, value)})
$.extend Extension Objectsvar Target = { One: ' Patridge ' }, Source = { Both: ' turtle doves ' }$.Extend(Target, Source)//=> {one: ' Patridge ',//
$.inarrayv1.0+从某个下标开始 查询元素在数组中的下标,没有符合条件的 则返回-1
? number
$.isarray determines whether an object is an array $.isfunction$.isplainobject$.map is also used to traverse the method, automatically filtered out, empty or undefined value $.trim before and after the removal of space
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Read the core methods in Zepto.js's core