兼容现有jQuery API的轻量级JavaScript库:Zepo

时间:2023-03-09 05:17:33
兼容现有jQuery API的轻量级JavaScript库:Zepo

Zepo是一个JavaScript框架,其特点是兼容现有jQuery API的同时,自身体积十分小;它与jQuery有着类似的API。如果你会jQuery,那么也就会使用Zepto了。

$('div') //=> all DIV elements on the page
$('#foo') //=> element with ID "foo"
// create element:
$("<p>Hello</p>") //=> the new P element
// create element with attributes:
$("<p />", { text:"Hello", id:"greeting", css:{color:'darkblue'} })
//=> <p id=greeting style="color:darkblue">Hello</p>
// execute callback when the page is ready:
Zepto(function($){
alert('Ready to Zepto!')
})

  文章转载:http://bbs.it-home.org/thread-4493-1-1.html