首页 jQuery-1.4.2学习手册

jQuery-1.4.2学习手册

举报
开通vip

jQuery-1.4.2学习手册 jQUERY 1.4.2 VISUAL CHEAT SHEET ❉ SELECTORS / 1. BASIC All Selector (“*”) Selects all elements. a Class Selector (“.class”) Matches all elements with the given name. a Element Selector (“element”) Selects all elements with the given tag name. a ID S...

jQuery-1.4.2学习手册
jQUERY 1.4.2 VISUAL CHEAT SHEET ❉ SELECTORS / 1. BASIC All Selector (“*”) Selects all elements. a Class Selector (“.class”) Matches all elements with the given name. a Element Selector (“element”) Selects all elements with the given tag name. a ID Selector (“#id”) Selects a single element with the given id attribute. a Multiple Selector (“selector1, selector2, selectorN”) Selects the combined results of all the specified selectors. a ❉ SELECTORS / 2. HIERARCHY Child Selector (“parent > child”) Selects all direct child elements specified by "child" of elements specified by "parent". a Descendant Selector (“ancestor descendant”) Selects all elements that are descendants of a given ancestor. a Next Adjacent Selector (“prev + next”) Selects all next elements matching "next" that are immediately preceded by a sibling "prev". a Next Siblings Selector (“prev ~ siblings”) Selects all sibling elements that follow after the "prev" element, have the same parent, and match the filtering "siblings" selector. a ❉ SELECTORS / 3. BASIC FILTER :animated Selector Select all elements that are in the progress of an animation at the time the selector is run. a :eq() Selector Select the element at index n within the matched set. a :even Selector Selects even elements, zero-indexed a :first Selector Selects the first matched element. a :gt() Selector Select all elements at an index greater than index within the matched set. a :header Selector Selects all elements that are headers, like h1, h2, h3 and so on. a :last Selector Selects the last matched element. a :lt() Selector Select all elements at an index less than index within the matched set. a :not() Selector Selects all elements that do not match the given selector. a :odd Selector Selects odd elements, zero-indexed. See also even. a ❉ SELECTORS / 4. CONTENT FILTER :contains() Selector Select all elements that contain the specified text. a :empty Selector Select all elements that have no children (including text nodes). a :has() Selector Selects elements which contain at least one element that matches the specified selector. a :parent Selector Select all elements that are the parent of another element, including text nodes. a ❉ SELECTORS / 5. ATTRIBUTE [name|=value] Selects elements that have the specified attribute with a value either equal to a given string or starting with that string followed by a hyphen (-). a [name*=value] Selects elements that have the specified attribute with a value containing the a given substring. a [name~=value] Selects elements that have the specified attribute with a value containing a given word, delimited by spaces. a [name$=value] Selects elements that have the specified attribute with a value ending exactly with a given string. a [name=value] Selects all elements that are headers, like h1, h2, h3 and so on. a [name!=value] Select elements that either don't have the specified attribute, or do have the specified attribute but not with a certain value. a [name^=value] Selects elements that have the specified attribute with a value beginning exactly with a given string. a [name] Selects elements that have the specified attribute, with any value. a [name=value][name2=value2] Matches elements that match all of the specified attribute filters. a ❉ SELECTORS / 6. CHILD FILTER :first-child Selector Selects all elements that are the first child of their parent. a :last-child Selector Selects all elements that are the last child of their parent. a :nth-child Selector Selects all elements that are the nth-child of their parent. a :only-child Selector Selects all elements that are the only child of their parent. a ❉ SELECTORS / 7. VISIBILITY FILTER :hidden Selector Selects all elements that are hidden. a :visible Selector Selects all elements that are visible. a ❉ SELECTORS / 8. FORM :button Selector Selects all button elements and elements of type button. a :checkbox Selector Selects all elements of type checkbox. a :checked Selector Matches all elements that are checked. a :disabled Selector Selects all elements that are disabled. a :enabled Selector Selects all elements that are enabled. a :file Selector Selects all elements of type file. a :image Selector Selects all elements of type image. a :input Selector Selects all input, textarea, select and button elements. a :password Selector Selects all elements of type password. a :radio Selector Selects all elements of type radio. a :reset Selector Selects all elements of type reset. a :selected Selector Selects all elements that are selected. a :submit Selector Selects all elements of type submit. a :text Selector Selects all elements of type text. a ❉ CORE / 1. THE jQUERY FUNCTION jQuery() Accepts a string containing a CSS selector which is then used to match a set of elements. jQ ❉ CORE / 2. OBJECT ACCESSORS .context The DOM node context originally passed to jQuery(); if none was passed then context will likely be the document. El .each( function(index, Element) ) Iterate over a jQuery object, executing a function for each matched element. jQ .get( [ index ] ) Retrieve the DOM elements matched by the jQuery object. El | a .index() ★ Search for a given element from among the matched elements. Num .length The number of elements in the jQuery object. Num .selector A selector representing selector originally passed to jQuery(). Str .size() Return the number of DOM elements matched by the jQuery object. Num .toArray() ★ Retrieve all the DOM elements contained in the jQuery set, as an array. a ❉ CORE / 3. DATA .queue( [ queueName ], newQueue) Show the queue of functions to be executed on the matched elements. jQ .data( obj ) ★ Store arbitrary data associated with the matched elements. jQ .removeData( [ name ] ) Remove a previously-stored piece of data. jQ .dequeue( [ queueName ] ) Execute the next function on the queue for the matched elements. jQ ❉ CORE / 4. PLUGINS jQuery.fn.extend( object ) Extends the jQuery element set to provide new methods (used to make a typical jQuery plugin). jQ jQuery.extend( object ) Extends the jQuery object itself. jQ ❉ CORE / 5. INTEROPERABILITY jQuery.noConflict( ) Relinquish jQuery's control of the $ variable. jQ jQuery.noConflict(extreme) Extends the jQuery object itself. This is to be used in an extreme case where you’d like to embed jQuery into a high-conflict environment. jQ SELECTORS ✼ CORE ✼ ATTRIBUTES ✼ CSS ✼ TRAVERSING ✼ MANIPULATION ✼ EVENTS ✼ EFFECTS ✼ AJAX ✼ UTILITIES ★ = NEW IN jQUERY 1.4.x / ❉ = DEPRECATED / a = ARRAY / jQ = jQUERY / El = ELEMENT / 0-1 = BOOLEAN / Obj = OBJECT / NUM = NUMBER / Str = STRING ❉ ATTRIBUTES / 1. ATTR .attr( attributeName ) Get the value of an attribute for the first element in the set of matched elements. Obj .attr( attributeName, value ) Set one or more attributes for the set of matched elements. Obj .removeAttr() Remove an attribute from each element in the set of matched elements. jQ ❉ ATTRIBUTES / 2. CLASS .addClass( class ) Adds the specified class(es) to each of the set of matched elements. jQ .hasClass( class ) Determine whether any of the matched elements are assigned the given class. 0-1 .removeClass( class ) Remove a single class, multiple classes, or all classes from each element in the set of matched elements. jQ .toggleClass( class, switch ) Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument. jQ ❉ ATTRIBUTES / 3. HTML .html() Get the HTML contents of the first element in the set of matched elements. Str .html( htmlString ) Set the HTML contents of each element in the set of matched elements. jQ ❉ ATTRIBUTES / 4. TEXT .text() Get the combined text contents of each element in the set of matched elements, including their descendants. Str .text( textString ) Set the content of each element in the set of matched elements to the specified text. jQ ❉ ATTRIBUTES / 5. VALUE .val() Get the current value of the first element in the set of matched elements. Str | a .val( value ) Set the value of each element in the set of matched elements. jQ ❉ CSS / 1. CSS .css( propertyName ) Get the value of a style property for the first element in the set of matched elements. Str .css( propertyName, value ) Set one or more CSS properties for the set of matched elements. jQ ❉ CSS / 2. POSITIONING .scrollLeft() Get the current horizontal position of the scroll bar for the first element in the set of matched elements. Int .scrollLeft( value ) Set the current horizontal position of the scroll bar for each of the set of matched elements. jQ .offset() Get the current coordinates of the first element in the set of matched elements, relative to the document. Obj {top, left} .offset( coordinates ) Set the current coordinates of every element in the set of matched elements, relative to the document. jQ .position() Get the current coordinates of the first element in the set of matched elements, relative to the offset parent. Obj {top, left} .scrollTop() Get the current vertical position of the scroll bar for the first element in the set of matched elements. Int .scrollTop( value ) Set the current vertical position of the scroll bar for each of the set of matched elements. ❉ CSS / 3. HEIGHT & WIDTH .height( value ) Set the CSS height of every matched element. jQ jQUERY 1.4.2 VISUAL CHEAT SHEET .height() Get the current computed height for the first element in the set of matched elements. Int .innerHeight() Get the current computed height for the first element in the set of matched elements, including padding but not border. Int .innerWidth() Get the current computed width for the first element in the set of matched elements, including padding but not border. Int .outerHeight() Get the current computed height for the first element in the set of matched elements, including padding, border, and optionally margin. Int .outerWidth() Get the current computed width for the first element in the set of matched elements, including padding and border. Int .width( value ) Set the CSS width of each element in the set of matched elements. jQ .width() Get the current computed width for the first element in the set of matched elements. Int ❉ TRAVERSING / 1. FILTERING .eq( - index ) ★ Reduce the set of matched elements to the one at the specified index. jQ .eq( index ) Reduce the set of matched elements to the one at the specified index. jQ .filter( selector ) Reduce the set of matched elements to those that match the selector or pass the function's test. jQ .is( selector ) Check the current matched set of elements against a selector and return true if at least one of these elements matches the selector. 0-1 .map( callback(index, domEl) ) Pass each element in the current matched set through a function, producing a new jQuery object containing the return values. jQ .not() Remove elements from the set of matched elements. jQ .slice( start, [ end ] ) Reduce the set of matched elements to a subset specified by a range of indices. jQ ❉ TRAVERSING / 2. TREE TRAVERSAL .children( [ selector ] ) Get the children of each element in the set of matched elements, optionally filtered by a selector. jQ .closest( selector ) Get the first ancestor element that matches the selector, beginning at the current element and progressing up through the DOM tree. jQ .closest( selectors, [ context ] ) ★ Get the first ancestor element that matches the selector, beginning at the current element and progressing up through the DOM tree. jQ .find( selector ) Get the descendants of each element in the current set of matched elements, filtered by a selector. jQ .next( [ selector ] ) Get the immediately following sibling of each element in the set of matched elements, optionally filtered by a selector. jQ .nextAll( [ selector ] ) Get all following siblings of each element in the set of matched elements, optionally filtered by a selector. jQ .nextUntil( [ selector ] ) Get all following siblings of each element up to but not including the element matched by the selector. jQ .offsetParent() Get the closest ancestor element that is positioned. jQ .parent( [ selector ] ) Get the parent of each element in the current set of matched elements, optionally filtered by a selector. jQ .parents( [ selector ] ) Get the ancestors of each element in the current set of matched elements, optionally filtered by a selector. jQ .parentsUntil( [ selector ] ) ★ Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector. jQ .prev( [ selector ] ) Get the immediately preceding sibling of each element in the set of matched elements, optionally filtered by a selector. jQ .prevAll( [ selector ] ) Get all preceding siblings of each element in the set of matched elements, optionally filtered by a selector. jQ .prevUntil( [ selector ] ) ★ Get the ancestors of each element in the current set of matched elements, optionally filtered by a selector. jQ .siblings( [ selector ] ) Get the siblings of each element in the set of matched elements, optionally filtered by a selector. jQ ❉ TRAVERSING / 2. MISCELLANEOUS .add() Add elements to the set of matched elements. jQ .add( selectors, [ context ] ) ★ Add elements to the set of matched elements. jQ .andSelf() Add the previous set of elements on the stack to the current set. jQ .contents() Get the children of each element in the set of matched elements, including text nodes. jQ .end() End the most recent filtering operation in the current chain and return the set of matched elements to its previous state. jQ ❉ MANIPULATION / 1. INSIDE .append( content ) Insert content, specified by the parameter, to the end of each element in the set of matched elements. jQ .append( function(index, html) ) ★ Insert content, specified by the parameter, to the end of each element in the set of matched elements. jQ .appendTo( target ) Insert every element in the set of matched elements to the end of the target. jQ .prepend( content ) Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. jQ .prependTo( target ) Insert content, specified by the parameter, to the end of each element in the set of matched elements. jQ SELECTORS ✼ CORE ✼ ATTRIBUTES ✼ CSS ✼ TRAVERSING ✼ MANIPULATION ✼ EVENTS ✼ EFFECTS ✼ AJAX ✼ UTILITIES ★ = NEW IN jQUERY 1.4.x / ❉ = DEPRECATED / a = ARRAY / jQ = jQUERY / El = ELEMENT / 0-1 = BOOLEAN / Obj = OBJECT / NUM = NUMBER / Str = STRING ❉ MANIPULATION / 2. OUTSIDE .after( content ) Insert content, specified by the parameter, after each element in the set of matched elements. jQ .after( function(index) ) ★ Insert content, specified by the parameter, to the end of each element in the set of matched elements. jQ .before( content ) Insert content, specified by the parameter, before each element in the set of matched elements. jQ .before( function ) ★ Insert content, specified by the parameter, before each element in the set of matched elements. jQ .insertAfter( target ) Insert every element in the set of matched elements after the target. jQ .insertBefore( target ) Insert every element in the set of matched elements before the target. jQ ❉ MANIPULATION / 3. AROUND .unwrap() ★ Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place. jQ .wrap( wrappingElement ) Wrap an HTML structure around each element in the set of matched elements. jQ .wrap( wrappingFunction ) ★ Wrap an HTML structure around each element in the set of matched elements. jQ .wrapAll( wrappingElement ) Wrap an HTML structure around all elements in the set of matched elements. jQ .wrapInner( wrappingElement ) Wrap an HTML structure around the content of each element in the set of matched elements. jQ .wrapInner( wrappingFunction ) ★ Wrap an HTML structure around the content of each element in the set of matched elements. jQ ❉ MANIPULATION / 4. REPLACING .replaceWith( newContent ) Replace each element in the set of matched elements with the provided new content. jQ jQUERY 1.4.2 VISUAL CHEAT SHEET .replaceWith( function ) Replace each element in the set of matched elements with the provided new content. jQ .replaceAll() A selector expression indicating which element(s) to replace. jQ ❉ MANIPULATION / 5. REMOVING .detach( [ selector ] ) ★ Remove the set of matched elements from the DOM. jQ .empty() Remove all child nodes of the set of matched elements from the DOM. jQ .remove( [ selector ] ) Remove the set of matched elements from the DOM. jQ ❉ MANIPULATION / 6. COPYING .clone( [ withDataAndEvents ] ) Create a copy of the set of matched elements. jQ ❉ EVENTS / 1. DOCUMENT LOADING .load( handler(eventObject) ) Bind an event handler to the "load" JavaScript event. jQ .ready( handler ) Specify a function to execute when the DOM is fully loaded. jQ .unload( handler(eventObject) ) Bind an event handler to the "unload" JavaScript event. jQ ❉ EVENTS / 2. HANDLER ATTACHMENT .bind( eventType, [ eventData ], handler (eventObject) ) Attach a handler to an event for the elements. jQ .delegate( selector, eventType, handler ) ★ Attach a handler to one or more events for all elements that match the selector, now or in the future, based on a specific set of root elements. jQ .die() ★ Remove all event handlers previously attached using .live() from the elements. jQ .live( eventType, eventData, handler ) ★ Attach a handler to the event for all elements which match the current selector, now or in the future. jQ .one( eventType, [ eventData ], handler (eventObject) ) Attach a handler to an event for the elements. The handler is executed at most once per element. jQ .trigger( eventType, extraParameters) Execute all handlers and behaviors attached to the matched elements for the given event type. jQ .triggerHandler( eventType, extraParameters ) Execute all handlers attached to an element for an event. jQ .unbind( eventType, handler (eventObject) ) ★ Remove a previously-attached event handler from the elements. jQ .undelegate() Remove a handler from the event for all elements which match the current selector, now or in the future, based upon a specific set of root elements. jQ ❉ EVENTS / 3. MOUSE EVENTS .click( handler(eventObject) ) Bind an event handler to the "click" JavaScript event, or trigger that event on an element. jQ .dblclick( handler(eventObject) ) Bind an event handler to the "dblclick" JavaScript event, or trigger that event on an element. jQ .focusin( handler(eventObject) ) Bind an event handler to the "focusin" JavaScript event. jQ .focusout( handler(eventObject) ) Bind an event handler to the "focusout" JavaScript event. jQ .hover( handlerIn(eventObject), handlerOut(eventObject) ) Bind two handlers to the matched elements, to be executed when the mouse pointer enters and leaves the elements. jQ .hover( handler(eventObject) ) ★ Bind a single handler to the matched el
本文档为【jQuery-1.4.2学习手册】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_981507
暂无简介~
格式:pdf
大小:350KB
软件:PDF阅读器
页数:4
分类:互联网
上传时间:2011-02-12
浏览量:15