Read core methods and zepto. jscore in zepto. js Core.

Source: Internet
Author: User

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 object
var 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.