Read the core methods in Zepto.js's core

Source: Internet
Author: User

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 Objects
var 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

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.