Read core methods and zepto. jscore in zepto. js Core.
Learn zepto. js, references: http://www.zeptojs.cn/
Like jQuery, its selection symbol is $;
The first contact is
$. () Select
$(selector, [context]) ⇒ collection$(<Zepto collection>) ⇒ same collection$(<DOM nodes>) ⇒ collection$(htmlString) ⇒ collectionZepto(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 is readyZepto(function($){ alert('Ready to Zepto!')})
$. Each traverses 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 objectvar target = { one: 'patridge' }, source = { two: 'turtle doves' }$.extend(target, source)//=> { one: 'patridge',//
$. InArray v1.0 +Query the subscript of an element in the array starting with a subscript. If no condition is met,-1 is returned.
$.inArray(element, array, [fromIndex]) ⇒ number
$. IsArray determines whether an object is an array $. isFunction $. isPlainObject $. map is also used for traversal. It is automatically filtered out. Empty or undefined values $. trim removes leading and trailing Spaces
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.