Skip to content

zhjlty/core.js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

core.jsBuild Status

light-weight JSlib compatible with jQuery/Zepto API

Usage

Gobal

<script src="dist/core.js"></script>

Use Bower

$ bower install core.js

API

HTML/Text/Value

text()

text()  ⇒ string
text(content)  ⇒ self  

html()

html()  ⇒ string
html(content)  ⇒ self   

val()

val()  ⇒ string
val(value)  ⇒ self

Node Manipulation

eq()

$('li').eq(0)   //=> only the first list item
$('li').eq(-1)  //=> only the last list item

get()

get()  ⇒ array
get(index)  ⇒ DOM node

parent()

parent([selector])  ⇒ collection

parents()

parents([selector])  ⇒ collection

children()

children([selector])  ⇒ collection

find()

find(selector)  ⇒ collection
find(collection)  ⇒ collection v1.0+
find(element)  ⇒ collection v1.0+

Class and Attributes

attr(name,value)

attr(name)  ⇒ string
attr(name, value)  ⇒ self

removeAttr(name)

removeAttr(name)  ⇒ self

hasClass(name)

hasClass(name)  ⇒ boolean

addClass(name)

addClass(name)  ⇒ self

removeClass(name)

removeClass([name])  ⇒ self

toggleClass(name)

toggleClass(names, [setting])  ⇒ self

CSS

css(name,value)

css(property)  ⇒ value
css([property1, property2, ...])  ⇒ object v1.1+
css(property, value) 

show()

show()  ⇒ self

hide()

hide()  ⇒ self

offset()

offset()  ⇒ object

width()

width()  ⇒ number
width(value)  ⇒ self

height()

height()  ⇒ number
height(value)  ⇒ self

Event Handler

on()

on(type, [selector], function(e){ ... })  ⇒ self

off()

off(type, [selector], function(e){ ... })  ⇒ self
off(type, [selector])  ⇒ self
off()  ⇒ self

trigger()

trigger(event, [args])  ⇒ self

XMLHttpRequest

ajax()

About

A min lib focus on dom handle

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%