jQuery 1.7 中文API (适用jQuery 1.7、jQuery 1.7.1)

jQuery 1.7 API Cheat Sheet 

Core

jQuery function

$. jQuery ( selector [, context] | element | elementArray | jQueryObject ), . jQuery ( )
$. jQuery ( html [, owner]  | html, props )
$. jQuery ( fn )
def. when (deferreds)
fn jQuery.sub ( )
$. holdReady ( hold )

jQuery Object Accessors

$ .each ( fn(index, element) )
num .size( ), .length
str. selector
el. context
$. eq ( index )
jQuery.error ( str )
[el],el. get ( [index] )
num. index ( ), . index ( selector | element )
$ jQuery.pushStack ( elements, [name, args] )
arr. toArray ( )

Interoperability

$ jQuery.noConflict ( [extreme] )

AJAX

Low-Level Interface

jqXHR jQuery.ajax ( options, [settings] )
  • mapaccepts
  • boolasync = true
  • fnbeforeSend( jqXHR, config)
  • boolcache = true
  • fncomplete( jqXHR, status)
  • mapcontents
  • strcontentType
  • objcontext
  • mapconverters
  • boolcrossDomain
  • obj, str data
  • fndataFilter( data, type )
  • boolglobal = true
  • mapheaders
  • boolifModified = false
  • strjsonp
  • fnjsonpCallback
  • strpassword
  • boolprocessData = true
  • strscriptCharset
  • mapstatusCode
  • numtimeout
  • booltraditional
  • strtype = 'GET'
  • strurl = curr. page
  • strusername
  • fnxhr
  • strdataType ∈ {xml, json, script, html}
  • fnerror( jqXHR, status, errorThrown )
  • fnsuccess( data, status, jqXHR )
jQuery.ajaxSetup ( options )

Miscellaneous

str. serialize (  )
[obj]. serializeArray (  )
str jQuery.param ( obj, [traditional] )

Shorthand Methods

$. load ( url [, data] [, fn( responseText, status, XHR )] )
jqXHR jQuery.get ( url [, data] [, fn( data, status, XHR )] [, type] )
jqXHR jQuery.getJSON ( url [, data] [, fn( data, status )] )
jqXHR jQuery.getScript ( url [, fn( data, status )] )
jqXHR jQuery.post ( url [, data] [, fn( data, status )] [, type] )

Global Ajax Event Handlers

$. ajaxComplete ( fn( event, XHR, options ) )
$. ajaxError ( fn( event, XHR, options, thrownError ) )
$. ajaxSend ( fn( event, XHR, options ) )
$. ajaxStart ( fn(  ) )
$. ajaxStop ( fn(  ) )
$. ajaxSuccess ( fn(event, XHR, options) )

Events

Page Load

$. ready ( fn() )

Event Handling

$. on ( events [, selector] [, data], handler ) 1.7+
$. on ( events-map [, selector] [, data] ) 1.7+
$. off ( events [, selector] [, handler] ) 1.7+
$. off ( events-map [, selector] ) 1.7+
$. bind ( type [, data ], fn(eventObj) )
$. bind ( type [, data], false )
$. bind ( array )
$. unbind ( [type] [, fn])
$. one ( type [, data ], fn(eventObj) )
$. trigger ( event [, data])
obj. triggerHandler ( event [, data])
$. delegate ( selector, type, [data], handler)
$. undelegate ( [selector, type, [handler]]) | selector, events | namespace )

Live Events

$. live ( eventType [, data], fn() )
$. die ( ), . die ( [eventType] [, fn() ])

Interaction Helpers

$. hover ( fnIn(eventObj), fnOut(eventObj))
$. toggle ( fn(eventObj), fn2(eventObj) [, ...])

Event Helpers

function ( [data,] [fn] )
$
. blur,
. change,
. click,
. error,
. focus,
. focusin,
. mouseup,
. resize,
. keydown,
. scroll,
. select,
. keyup,
. submit,
. load ( [data,] fn ),
. unload ( [data,] fn )

Effects

Basics

$. show ( [ duration [, easing] [, fn] ]  )
$. hide ( [ duration [, easing] [, fn] ]  )
$. toggle ( [showOrHide] )
$. toggle ( duration [, easing] [, fn] )

Sliding

$. slideDown ( duration [, easing] [, fn] )
$. slideUp ( duration [, easing] [, fn] )
$. slideToggle ( [duration] [, easing] [, fn] )

Fading

$. fadeIn ( duration [, easing] [, fn] )
$. fadeOut ( duration [, easing] [, fn] )
$. fadeTo ( [duration,] opacity [, easing] [, fn] )
$. fadeToggle ( [duration,] [, easing] [, fn] )

Custom

$. animate ( params [, duration] [, easing] [, fn] )
$. animate ( params, options )
$. stop ( [queue] [, clearQueue] [, jumpToEnd] ) 1.7*
$. delay ( duration [, queueName] )

Settings

Attributes

Attributes

str. attr ( name | name , value )
$. attr ( name, val | map | name, fn(index, attr) )
$. removeAttr ( name )
$. prop ( name )
$. removeProp ( name )

Class

$. addClass ( class | fn(index, class) )
bool. hasClass ( class )
$. removeClass ( [class] | fn(index, class) )
$. toggleClass ( class [, switch] | fn(index, class) [, switch] )

HTML, text

str. html ( )
$. html ( val | fn(index, html) )
str. text ( )
$. text ( val | fn(index, html) )

Value

str,arr. val ( )
$. val ( val | fn() )

CSS

CSS

str. css ( name )
$. css ( name, val | map | name, fn(index, val) )

Positioning

obj. offset ( )
$. offset ( coord | fn( index, coord ) )
$. offsetParent ( )
obj. position ( )
int. scrollTop ( )
$. scrollTop ( val )
int. scrollLeft ( )
$. scrollLeft ( val )

Height and Width

int. height ( )
$. height ( val | fn(index, height ) )
int. width ( )
$. width ( val | fn(index, height ) )
int. innerHeight ( )
int. innerWidth ( )
int. outerHeight ( [margin] )
int. outerWidth ( [margin] )

Traversing

Filtering

$. eq ( index )
$. first ( )
$. last ( )
$. has ( selector ), . has ( element )
$. filter ( selector ), . filter ( fn(index) )
bool. is ( selector | function(index) | jQuery object | element ) 1.7*
$. map ( fn(index, element) )
$. not ( selector ), . not ( elements ), . not ( fn( index ) )
$. slice ( start [, end] )

Tree traversal

$. children ( [selector] )
$. closest ( selector [, context] | jQuery object | element )
arr. closest ( selectors [, context] )
$. find ( selector | jQuery object | element )
$. next ( [selector] )
$. nextAll ( [selector] )
$. nextUntil ( [selector] )
$. offsetParent ( )
$. parent ( [selector] )
$. parents ( [selector] )
$. parentsUntil ( [selector] )
$. prev ( [selector] )
$. prevAll ( [selector] )
$. prevUntil ( [selector] )
$. siblings ( [selector] )

Miscellaneous

$. add ( selector [, context] | elements | html )
$. andSelf ( )
$. contents ( )
$. end ( )

Manipulation

Inserting Inside

$. append ( content | fn( index, html ) )
$. appendTo ( target )
$. prepend ( content | fn( index, html ) )
$. prependTo ( target )

Inserting Outside

$. after ( content | fn() )
$. before ( content | fn() )
$. insertAfter ( target )
$. insertBefore ( target )

Inserting Around

$. unwrap ( )
$. wrap ( wrappingElement | fn )
$. wrapAll ( wrappingElement | fn )
$. wrapInner ( wrappingElement | fn )

Replacing

$. replaceWith ( content | fn )
$. replaceAll ( selector )

Removing

$. detach ( [selector] )
$. empty ( )
$. remove ( [selector] )

Copying

$. clone ( [withDataAndEvents], [deepWithDataAndEvents] )

Deferred

deferred object = {
def. always (alwaysCallbacks [, alwaysCallbacks])
def done (doneCallbacks)
def fail (failCallbacks)
bool isRejected ()
bool isResolved ()
def. notify ( args ) 1.7+
def. notifyWith (context, [args]) 1.7+
def. pipe ([doneFilter] [, failFilter] [, progressFilter] ) 1.7*
def. progress ( progressCallbacks ) 1.7+
def reject ([args])
def rejectWith (context, [args])
def resolve ([args])
def resolveWith (context, [args])
str state ()
def then (doneCallbacks, failCallbacks [, progressCallbacks]) 1.7*
}
def. promise ([target])

Callbacks

callbacks object = { 1.7+
und. add (callbacks)
und. disable ()
und. empty ()
und. fire (arguments)
bool. fired ()
und. fireWith ([context] [, args])
bool. has (callback)
und. lock ()
bool. locked ()
und. remove (callbacks)
}
cb $.Callbacks ( flags )

Utilities

Browser and Feature Detection

obj jQuery.browser deprecated
str jQuery.browser.version deprecated
bool jQuery.boxModel deprecated

Basic operations

obj jQuery.each ( obj, fn( i, valueOfElement ) )
obj jQuery.extend ( [deep,] target, obj1 [, objN] )
arr jQuery.grep ( arr, fn( el, i ) [, invert] )
arr jQuery.makeArray ( obj )
arr jQuery.map ( arrayOrObject, fn( el, i ) )
num jQuery.inArray ( val, arr )
arr jQuery.merge ( first, second )
fn jQuery.proxy ( fn, scope | scope, name )
arr jQuery.unique ( arr )
str jQuery.trim ( str )
obj jQuery.parseJSON ( str )

Data functions

$. clearQueue ( [name] )
$. dequeue ( [name] ), jQuery.dequeue ( [name] )
obj jQuery.data ( el, key ), jQuery.data (  )
obj. data (  ), . data ( key )
$. data ( key, val | obj )
$. removeData ( [name] |[list]) 1.7*
[fn]. queue ( [name] ) jQuery.queue ( [name] )
$. queue ( [name,] fn( next ) ), jQuery.queue ( [name,] fn(  ) )
$. queue ( [name,] queue ), jQuery.queue ( [name,] queue )

Test operations

str jQuery.type ( obj )
bool jQuery.isArray ( obj )
bool jQuery.isEmptyObject ( obj )
bool jQuery.isFunction ( obj )
bool jQuery.isPlainObject ( obj )
bool jQuery.isWindow ( obj )
bool jQuery.isNumeric ( val ) 1.7+

获取jQuery 1.7 中文API (适用jQuery 1.7和jQuery 1.7.1)


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值