([{"url":"http:\/\/api.jquery.com\/add\/","title":".add()","type":"method","signatures":[{"added":"1.0","params":[{"name":"selector","type":"Selector","optional":"","desc":"A string containing a selector expression to match additional elements against."}]},{"added":"1.0","params":[{"name":"elements","type":"Elements","optional":"","desc":"one or more elements to add to the set of matched elements."}]},{"added":"1.0","params":[{"name":"html","type":"HTML","optional":"","desc":"An HTML fragment to add to the set of matched elements."}]},{"added":"1.4","params":[{"name":"selector","type":"Selector","optional":"","desc":"A string containing a selector expression to match additional elements against."},{"name":"context","type":"Element","optional":"","desc":"Add some elements rooted against the specified context."}]}],"desc":"Add elements to the set of matched elements.","longdesc":"
Given a jQuery object that represents a set of DOM elements, the Consider a page with a simple list and a paragraph following it:<\/p>\n We can select the list items and then the paragraph by using either a selector or a reference to the DOM element itself as the Or:<\/p>\n The result of this call is a red background behind all four elements.\nUsing an HTML snippet as the Although the new paragraph has been created and its background color changed, it still does not appear on the page. To place it on the page, we could add one of the insertion methods to the chain.<\/p>\n As of jQuery 1.4 the results from .add() will always be returned in document order (rather than a simple concatenation).<\/p>\n","return":"jQuery"},{"url":"http:\/\/api.jquery.com\/addClass\/","title":".addClass()","type":"method","signatures":[{"added":"1.0","params":[{"name":"className","type":"String","optional":"","desc":"One or more class names to be added to the class attribute of each matched element."}]},{"added":"1.4","params":[{"name":"function(index, class)","type":"Function","optional":"","desc":"A function returning one or more space-separated class names to be added. Receives the index position of the element in the set and the old class value as arguments."}]}],"desc":"Adds the specified class(es) to each of the set of matched elements.","longdesc":" It's important to note that this method does not replace a class. It simply adds the class, appending it to any which may already be assigned to the elements.<\/p>\n More than one class may be added at a time, separated by a space, to the set of matched elements, like so:<\/p>\n This method is often used with Here, the As of jQuery 1.4, the Given an unordered list with five The Consider the following HTML:<\/p>\n\t\t\t\t We can create content and insert it after several elements at once:<\/p>\n\t\t\t\t Each inner We can also select an element on the page and insert it after another:<\/p>\n\t\t\t\t If an element selected this way is inserted elsewhere, it will be moved after the target (not cloned):<\/p>\n\t\t\t\t If there is more than one target element, however, cloned copies of the inserted element will be created for each target after the first.<\/p>\n As of jQuery 1.4, The result is a jQuery set containing a div and a paragraph, in that order. We can further manipulate that set, even before inserting it in the document.<\/p>\n This results in the following elements inserted just before the closing As of jQuery 1.4, This inserts a Whenever an Ajax request completes, jQuery triggers the To observe this method in action, we can set up a basic Ajax load request:<\/p>\n\t\t\t\t We can attach our event handler to any element:<\/p>\n\t\t\t\t Now, we can make an Ajax request using any jQuery method:<\/p>\n\t\t\t\t When the user clicks the button and the Ajax request completes, the log message is displayed.<\/p>\n\n\t\t\t\t Note:<\/strong> Because All Whenever an Ajax request completes with an error, jQuery triggers the To observe this method in action, we can set up a basic Ajax load request:<\/p>\n\t\t\t\t We can attach our event handler to any element:<\/p>\n\t\t\t\t Now, we can make an Ajax request using any jQuery method:<\/p>\n\t\t\t\t When the user clicks the button and the Ajax request fails, because the requested file is missing, the log message is displayed.<\/p>\n\n\t\t\t\t Note:<\/strong> Because All Whenever an Ajax request is about to be sent, jQuery triggers the To observe this method in action, we can set up a basic Ajax load request:<\/p>\n We can attach our event handler to any element:<\/p>\n Now, we can make an Ajax request using any jQuery method:<\/p>\n When the user clicks the button and the Ajax request is about to begin, the log message is displayed.<\/p>\n\n Note:<\/strong> Because All Whenever an Ajax request is about to be sent, jQuery checks whether there are any other outstanding Ajax requests. If none are in progress, jQuery triggers the To observe this method in action, we can set up a basic Ajax load request:<\/p>\n\t\t\t\t We can attach our event handler to any element:<\/p>\n\t\t\t\t Now, we can make an Ajax request using any jQuery method:<\/p>\n\t\t\t\t When the user clicks the button and the Ajax request is sent, the log message is displayed.<\/p>\n\n\t\t\t\t Note:<\/strong> Because Whenever an Ajax request completes, jQuery checks whether there are any other outstanding Ajax requests. If none remain, jQuery triggers the To observe this method in action, we can set up a basic Ajax load request:<\/p>\n We can attach our event handler to any element:<\/p>\n Now, we can make an Ajax request using any jQuery method:<\/p>\n When the user clicks the button and the Ajax request completes, the log message is displayed.<\/p>\n \t Because Whenever an Ajax request completes successfully, jQuery triggers the To observe this method in action, we can set up a basic Ajax load request:<\/p>\n\t\t We can attach our event handler to any element:<\/p>\n Now, we can make an Ajax request using any jQuery method:<\/p>\n When the user clicks the button and the Ajax request completes successfully, the log message is displayed.<\/p>\n\n\n Note:<\/strong> Because All Caution: The all, or universal, selector is extremely slow, except when used by itself.<\/p> "},{"url":"http:\/\/api.jquery.com\/andSelf\/","title":".andSelf()","type":"method","signatures":[{"added":"1.2"}],"desc":"Add the previous set of elements on the stack to the current set.","longdesc":" As described in the discussion for Consider a page with a simple list on it:<\/p>\n If we begin at the third item, we can find the elements which come after it:<\/p>\n The result of this call is a red background behind items 3, 4 and 5. First, the initial selector locates item 3, initializing the stack with the set containing just this item. The call to The All animated properties should be numeric (except as noted below); properties that are non-numeric cannot be animated using basic jQuery functionality. (For example, In addition to numeric values, each property can take the strings Animated properties can also be relative. If a value is supplied with a leading Durations are given in milliseconds; higher values indicate slower animations, not faster ones. The strings If supplied, the callback is fired once the animation is complete. This can be useful for stringing different animations together in sequence. The callback is not sent any arguments, but We can animate any element, such as a simple image:<\/p>\n We can animate the opacity, left offset, and height of the image simultaneously:<\/p>\n \n Note that we have specified \n The The The jQuery UI<\/a> project extends the The remaining parameter of As of jQuery version 1.4, we can set per-property easing functions within a single We can, for example, simultaneously animate the width and height with the In the second version of As previously noted, a plug-in is required for the The .add()<\/code> method constructs a new jQuery object from the union of those elements and the ones passed into the method. The argument to .add()<\/code> can be pretty much anything that $()<\/code> accepts, including a jQuery selector expression, references to DOM elements, or an HTML snippet.<\/p>\n<ul>\n <li>list item 1<\/li>\n <li>list item 2<\/li>\n <li>list item 3<\/li>\n<\/ul>\n<p>a paragraph<\/p><\/pre>\n
.add()<\/code> method's argument:<\/p>\n$('li').add('p').css('background-color', 'red');<\/pre>\n$('li').add(document.getElementsByTagName('p')[0])\n .css('background-color', 'red');<\/pre>\n.add()<\/code> method's argument (as in the third version), we can create additional elements on the fly and add those elements to the matched set of elements. Let's say, for example, that we want to alter the background of the list items along with a newly created paragraph:<\/p>\n$('li').add('<p id=\"new\">new paragraph<\/p>')\n .css('background-color', 'red');<\/pre>\n$('p').addClass('myClass yourClass');<\/pre>\n .removeClass()<\/code> to switch elements' classes from one to another, like so:<\/p>\n $('p').removeClass('myClass noClass').addClass('yourClass');<\/pre>\n myClass<\/code> and noClass<\/code> classes are removed from all paragraphs, while yourClass<\/code> is added.<\/p>\n.addClass()<\/code> method allows us to set the class name by passing in a function.<\/p>\n$('ul li:last').addClass(function() {\n return 'item-' + $(this).index();\n});<\/pre>\n<li><\/code> elements, this example adds the class \"item-4\" to the last <li><\/code>.<\/p>\n\n\n","return":"jQuery"},{"url":"http:\/\/api.jquery.com\/after\/","title":".after()","type":"method","signatures":[{"added":"1.0","params":[{"name":"content","type":"String, Element, jQuery","optional":"","desc":"An element, HTML string, or jQuery object to insert after each element in the set of matched elements."}]},{"added":"1.4","params":[{"name":"function(index)","type":"Function","optional":"","desc":"A function that returns an HTML string to insert after each element in the set of matched elements."}]}],"desc":"Insert content, specified by the parameter, after each element in the set of matched elements.","longdesc":".after()<\/code> and .insertAfter()<\/a><\/code> methods perform the same task. The major difference is in the syntax\u2014specifically, in the placement of the content and target. With .after()<\/code>, the selector expression preceding the method is the container after which the content is inserted. With .insertAfter()<\/code>, on the other hand, the content precedes the method, either as a selector expression or as markup created on the fly, and it is inserted after the target container.<\/p>\n\t\t\t\t<div class=\"container\">\n <h2>Greetings<\/h2>\n <div class=\"inner\">Hello<\/div>\n <div class=\"inner\">Goodbye<\/div>\n<\/div><\/pre>\n\t\t\t\t
$('.inner').after('<p>Test<\/p>');<\/pre>\n\t\t\t\t<div><\/code> element gets this new content:<\/p>\n\t\t\t\t<div class=\"container\">\n <h2>Greetings<\/h2>\n <div class=\"inner\">Hello<\/div>\n <p>Test<\/p>\n <div class=\"inner\">Goodbye<\/div>\n <p>Test<\/p>\n<\/div><\/pre>\n\t\t\t\t
$('.container').after($('h2'));<\/pre>\n\t\t\t\t<div class=\"container\">\n <div class=\"inner\">Hello<\/div>\n <div class=\"inner\">Goodbye<\/div>\n<\/div>\n<h2>Greetings<\/h2><\/pre>\n\t\t\t\t
Inserting Disconnected DOM nodes<\/h4>\n
.before()<\/code> and .after()<\/code> will also work on disconnected DOM nodes. For example, given the following code:<\/p>\n$('<div\/>').after('<p><\/p>');<\/pre>\n$('<div\/>').after('<p><\/p>').addClass('foo')\n .filter('p').attr('id', 'bar').html('hello')\n.end()\n.appendTo('body');<\/pre>\n<\/body><\/code> tag:<\/p>\n\n<div class=\"foo\"><\/div>\n<p class=\"foo\" id=\"bar\">hello<\/p>\n<\/pre>\n
.after()<\/code> allows us to pass a function that returns the elements to insert.<\/p>\n$('p').after(function() {\n return '<div>' + this.className + '<\/div>';\n});<\/pre>\n<div><\/code> after each paragraph, containing the class name(s) of each paragraph in turn.<\/p>\n","return":"jQuery"},{"url":"http:\/\/api.jquery.com\/ajaxComplete\/","title":".ajaxComplete()","type":"method","signatures":[{"added":"1.0","params":[{"name":"handler(event, XMLHttpRequest, ajaxOptions)","type":"Function","optional":"","desc":"The function to be invoked."}]}],"desc":"Register a handler to be called when Ajax requests complete. This is an Ajax Event<\/a>.","longdesc":"ajaxComplete<\/code> event. Any and all handlers that have been registered with the .ajaxComplete()<\/code> method are executed at this time.<\/p>\n\t\t\t\t<div class=\"trigger\">Trigger<\/div>\n<div class=\"result\"><\/div>\n<div class=\"log\"><\/div>\n<\/pre>\n\t\t\t\t
$('.log').ajaxComplete(function() {\n $(this).text('Triggered ajaxComplete handler.');\n});\n<\/pre>\n\t\t\t\t$('.trigger').click(function() {\n $('.result').load('ajax\/test.html');\n});<\/pre>\n\t\t\t\t.ajaxComplete()<\/code> is implemented as a method of jQuery object instances, we can use the this<\/code> keyword as we do here to refer to the selected elements within the callback function.<\/p>\n\n\t\t\t\tajaxComplete<\/code> handlers are invoked, regardless of what Ajax request was completed. If we must differentiate between the requests, we can use the parameters passed to the handler. Each time an ajaxComplete<\/code> handler is executed, it is passed the event object, the XMLHttpRequest<\/code> object, and the settings object that was used in the creation of the request. For example, we can restrict our callback to only handling events dealing with a particular URL:<\/p>\n\t\t\t\t$('.log').ajaxComplete(function(e, xhr, settings) {\n if (settings.url == 'ajax\/test.html') {\n $(this).text('Triggered ajaxComplete handler.');\n }\n});<\/pre>","return":"jQuery"},{"url":"http:\/\/api.jquery.com\/ajaxError\/","title":".ajaxError()","type":"method","signatures":[{"added":"1.0","params":[{"name":"handler(event, XMLHttpRequest, ajaxOptions, thrownError)","type":"Function","optional":"","desc":"The function to be invoked."}]}],"desc":"Register a handler to be called when Ajax requests complete with an error. This is an Ajax Event<\/a>.","longdesc":"ajaxError<\/code> event. Any and all handlers that have been registered with the .ajaxError()<\/code> method are executed at this time.<\/p>\n\t\t\t\t<div class=\"trigger\">Trigger<\/div>\n<div class=\"result\"><\/div>\n<div class=\"log\"><\/div><\/pre>\n\t\t\t\t
$('.log').ajaxError(function() {\n $(this).text('Triggered ajaxError handler.');\n});<\/pre>\n\t\t\t\t$('.trigger').click(function() {\n $('.result').load('ajax\/missing.html');\n});<\/pre>\n\t\t\t\t.ajaxError()<\/code> is implemented as a method of jQuery object instances, we can use the this<\/code> keyword as we do here to refer to the selected elements within the callback function.<\/p>\n\n\t\t\t\tajaxError<\/code> handlers are invoked, regardless of what Ajax request was completed. If we must differentiate between the requests, we can use the parameters passed to the handler. Each time an ajaxError<\/code> handler is executed, it is passed the event object, the XMLHttpRequest<\/code> object, and the settings object that was used in the creation of the request. If the request failed because JavaScript raised an exception, the exception object is passed to the handler as a fourth parameter. For example, we can restrict our callback to only handling events dealing with a particular URL:<\/p>\n\t\t\t\t$('.log').ajaxError(function(e, xhr, settings, exception) {\n if (settings.url == 'ajax\/missing.html') {\n $(this).text('Triggered ajaxError handler.');\n }\n});<\/pre>","return":"jQuery"},{"url":"http:\/\/api.jquery.com\/ajaxSend\/","title":".ajaxSend()","type":"method","signatures":[{"added":"1.0","params":[{"name":"handler(event, XMLHttpRequest, ajaxOptions)","type":"Function","optional":"","desc":"The function to be invoked."}]}],"desc":"","longdesc":"\n ajaxSend<\/code> event. Any and all handlers that have been registered with the .ajaxSend()<\/code> method are executed at this time.<\/p>\n <div class=\"trigger\">Trigger<\/div>\n<div class=\"result\"><\/div>\n<div class=\"log\"><\/div><\/pre>\n
$('.log').ajaxSend(function() {\n $(this).text('Triggered ajaxSend handler.');\n});<\/pre>\n $('.trigger').click(function() {\n $('.result').load('ajax\/test.html');\n});<\/pre>\n .ajaxSend()<\/code> is implemented as a method of jQuery instances, we can use the this<\/code> keyword as we do here to refer to the selected elements within the callback function.<\/p>\n\n ajaxSend<\/code> handlers are invoked, regardless of what Ajax request is to be sent. If we must differentiate between the requests, we can use the parameters passed to the handler. Each time an ajaxSend<\/code> handler is executed, it is passed the event object, the XMLHttpRequest<\/code> object, and the settings object<\/a> that was used in the creation of the Ajax request. For example, we can restrict our callback to only handling events dealing with a particular URL:<\/p>\n $('.log').ajaxSend(function(e, xhr, settings) {\n if (settings.url == 'ajax\/test.html') {\n $(this).text('Triggered ajaxSend handler.');\n }\n});<\/pre>\n ","return":"jQuery"},{"url":"http:\/\/api.jquery.com\/ajaxStart\/","title":".ajaxStart()","type":"method","signatures":[{"added":"1.0","params":[{"name":"handler()","type":"Function","optional":"","desc":"The function to be invoked."}]}],"desc":"Register a handler to be called when the first Ajax request begins. This is an Ajax Event<\/a>.","longdesc":"ajaxStart<\/code> event. Any and all handlers that have been registered with the .ajaxStart()<\/code> method are executed at this time.<\/p>\n\t\t\t\t<div class=\"trigger\">Trigger<\/div>\n<div class=\"result\"><\/div>\n<div class=\"log\"><\/div><\/pre>\n\t\t\t\t
$('.log').ajaxStart(function() {\n $(this).text('Triggered ajaxStart handler.');\n});<\/pre>\n\t\t\t\t$('.trigger').click(function() {\n $('.result').load('ajax\/test.html');\n});<\/pre>\n\t\t\t\t.ajaxStart()<\/code> is implemented as a method of jQuery object instances, we can use the this<\/code> keyword as we do here to refer to the selected elements within the callback function.<\/p>\n","return":"jQuery"},{"url":"http:\/\/api.jquery.com\/ajaxStop\/","title":".ajaxStop()","type":"method","signatures":[{"added":"1.0","params":[{"name":"handler()","type":"Function","optional":"","desc":"The function to be invoked."}]}],"desc":"Register a handler to be called when all Ajax requests have completed. This is an Ajax Event<\/a>.","longdesc":"\n ajaxStop<\/code> event. Any and all handlers that have been registered with the .ajaxStop()<\/code> method are executed at this time.<\/p>\n <div class=\"trigger\">Trigger<\/div>\n<div class=\"result\"><\/div>\n<div class=\"log\"><\/div><\/pre>\n
$('.log').ajaxStop(function() {\n $(this).text('Triggered ajaxStop handler.');\n});<\/pre>\n $('.trigger').click(function() {\n $('.result').load('ajax\/test.html');\n});<\/pre>\n .ajaxStop()<\/code> is implemented as a method of jQuery object instances, we can use the this<\/code> keyword as we do here to refer to the selected elements within the callback function.<\/p>\n ","return":"jQuery"},{"url":"http:\/\/api.jquery.com\/ajaxSuccess\/","title":".ajaxSuccess()","type":"method","signatures":[{"added":"1.0","params":[{"name":"handler(event, XMLHttpRequest, ajaxOptions)","type":"Function","optional":"","desc":"The function to be invoked."}]}],"desc":"","longdesc":"\n ajaxSuccess<\/code> event. Any and all handlers that have been registered with the .ajaxSuccess()<\/code> method are executed at this time.<\/p>\n <div class=\"trigger\">Trigger<\/div>\n<div class=\"result\"><\/div>\n<div class=\"log\"><\/div><\/pre>\n
$('.log').ajaxSuccess(function() {\n $(this).text('Triggered ajaxSuccess handler.');\n});<\/pre>\n $('.trigger').click(function() {\n $('.result').load('ajax\/test.html');\n});<\/pre>\n\t\t.ajaxSuccess()<\/code> is implemented as a method of jQuery object instances, we can use the this<\/code> keyword as we do here to refer to the selected elements within the callback function.<\/p>\n\n\t\tajaxSuccess<\/code> handlers are invoked, regardless of what Ajax request was completed. If we must differentiate between the requests, we can use the parameters passed to the handler. Each time an ajaxSuccess<\/code> handler is executed, it is passed the event object, the XMLHttpRequest<\/code> object, and the settings object that was used in the creation of the request. For example, we can restrict our callback to only handling events dealing with a particular URL:<\/p>\n\t $('.log').ajaxSuccess(function(e, xhr, settings) {\n if (settings.url == 'ajax\/test.html') {\n $(this).text('Triggered ajaxSuccess handler.');\n }\n});<\/pre>\n ","return":"jQuery"},{"url":"http:\/\/api.jquery.com\/all-selector\/","title":"All Selector (\"*\")","type":"selector","signatures":[{"added":"1.0"}],"desc":"Selects all elements.","longdesc":".end()<\/code> above, jQuery objects maintain an internal stack that keeps track of changes to the matched set of elements. When one of the DOM traversal methods is called, the new set of elements is pushed onto the stack. If the previous set of elements is desired as well, .andSelf()<\/code> can help.<\/p>\n\n<ul>\n <li>list item 1<\/li>\n <li>list item 2<\/li>\n <li class=\"third-item\">list item 3<\/li>\n <li>list item 4<\/li>\n <li>list item 5<\/li>\n<\/ul>\n<\/pre>\n
$('li.third-item').nextAll().andSelf()\n .css('background-color', 'red');\n<\/pre>\n.nextAll()<\/code> then pushes the set of items 4 and 5 onto the stack. Finally, the .andSelf()<\/code> invocation merges these two sets together, creating a jQuery object that points to all three items.<\/p>","return":"jQuery"},{"url":"http:\/\/api.jquery.com\/animate\/","title":".animate()","type":"method","signatures":[{"added":"1.0","params":[{"name":"properties","type":"Options","optional":"","desc":"A map of CSS properties that the animation will move toward."},{"name":"duration","type":"String,Number","optional":"optional","desc":"A string or number determining how long the animation will run."},{"name":"easing","type":"String","optional":"optional","desc":"A string indicating which easing function to use for the transition."},{"name":"callback","type":"Callback","optional":"optional","desc":"A function to call once the animation is complete."}]},{"added":"1.0","params":[{"name":"properties","type":"Options","optional":"","desc":"A map of CSS properties that the animation will move toward."},{"name":"options","type":"Options","optional":"","desc":"A map of additional options to pass to the method. Supported keys:\n \n
duration<\/code>: A string or number determining how long the animation will run.<\/li>\n easing<\/code>: A string indicating which easing function to use for the transition.<\/li>\n complete<\/code>: A function to call once the animation is complete.<\/li>\n step<\/code>: A function to be called after each step of the animation.<\/li>\n queue<\/code>: A Boolean indicating whether to place the animation in the effects queue. If false<\/code>, the animation will begin immediately.<\/li>\n specialEasing<\/code>: A map of one or more of the CSS properties defined by the properties argument and their corresponding easing functions (added 1.4).<\/li>\n <\/ul>\n "}]}],"desc":"Perform a custom animation of a set of CSS properties.","longdesc":"\n .animate()<\/code> method allows us to create animation effects on any numeric CSS property. The only required parameter is a map of CSS properties. This map is similar to the one that can be sent to the .css()<\/code> method, except that the range of properties is more restrictive.<\/p>\nwidth<\/code>, height<\/code>, or left<\/code> can be animated but background-color<\/code> cannot be.) Property values are treated as a number of pixels unless otherwise specified. The units em<\/code> and %<\/code> can be specified where applicable.<\/p>\n'show'<\/code>, 'hide'<\/code>, and 'toggle'<\/code>. These shortcuts allow for custom hiding and showing animations that take into account the display type of the element.<\/p>\n+=<\/code> or -=<\/code> sequence of characters, then the target value is computed by adding or subtracting the given number from the current value of the property.<\/p>\nDuration<\/h4>\n
'fast'<\/code> and 'slow'<\/code> can be supplied to indicate durations of 200<\/code> and 600<\/code> milliseconds, respectively.<\/p>\nCallback Function<\/h4>\n
this<\/code> is set to the DOM element being animated. If multiple elements are animated, it is important to note that the callback is executed once per matched element, not once for the animation as a whole.<\/p>\n<div id=\"clickme\">\n Click here\n<\/div>\n<img id=\"book\" src=\"book.png\" alt=\"\" width=\"100\" height=\"123\" \n style=\"position: relative; left: 10px;\" \/><\/pre>\n
$('#clickme').click(function() {\n $('#book').animate({\n opacity: 0.25,\n left: '+=50',\n height: 'toggle'\n }, 5000, function() {\n \/\/ Animation complete.\n });\n});\n<\/pre>\n
\n<\/p>\ntoggle<\/code> as the target value of the height<\/code> property. Since the image was visible before, the animation shrinks the height to 0 to hide it. A second click then reverses this transition:\n<\/p>\n
\n<\/p>\n\nopacity<\/code> of the image is already at its target value, so this property is not animated by the second click. Since we specified the target value for left<\/code> as a relative value, the image moves even farther to the right during this second animation.<\/p>\nposition<\/code> attribute of the element must not be static<\/code> if we wish to animate the left<\/code> property as we do in the example.<\/p>\n.animate()<\/code> method by allowing some non-numeric styles such as colors to be animated. The project also includes mechanisms for specifying animations through CSS classes rather than individual attributes.<\/p><\/blockquote>\nEasing<\/h4>\n
.animate()<\/code> is a string naming an easing function to use. An easing function specifies the speed at which the animation progresses at different points within the animation. The only easing implementations in the jQuery library are the default, called swing<\/code>, and one that progresses at a constant pace, called linear<\/code>. More easing functions are available with the use of plug-ins, most notably the jQuery UI suite<\/a>.<\/p>\nPer-property Easing<\/h4>\n
.animate()<\/code> call. In the first version of .animate()<\/code>, each property can take an array as its value: The first member of the array is the CSS property and the second member is an easing function. If a per-property easing function is not defined for a particular property, it uses the value of the .animate()<\/code> method's optional easing argument. If the easing argument is not defined, the default swing<\/code> function is used.<\/p>\nswing<\/code> easing function and the opacity with the linear<\/code> easing function:<\/p>\n$('#clickme').click(function() {\n $('#book').animate({\n width: ['toggle', 'swing'],\n height: ['toggle', 'swing'],\n opacity: 'toggle'\n }, 5000, 'linear', function() {\n $(this).after('<div>Animation complete.<\/div>');\n });\n});<\/pre>\n.animate()<\/code>, the options map can include the specialEasing<\/code> property, which is itself a map of CSS properties and their corresponding easing functions. We can simultaneously animate the width using the linear<\/code> easing function and the height using the easeOutBounce<\/code> easing function.<\/p>\n$('#clickme').click(function() {\n $('#book').animate({\n width: 'toggle',\n height: 'toggle'\n }, {\n duration: 5000, \n specialEasing: {\n width: 'linear',\n height: 'easeOutBounce'\n }, \n complete: function() {\n $(this).after('<div>Animation complete.<\/div>');\n }\n });\n});<\/pre>\neaseOutBounce<\/code> function.<\/p>\n\n","return":"jQuery"},{"url":"http:\/\/api.jquery.com\/animated-selector\/","title":":animated Selector","type":"selector","signatures":[{"added":"1.2"}],"desc":"Select all elements that are in the progress of an animation at the time the selector is run.","longdesc":".append()<\/code> method inserts the specified content as the last child of each element in the jQuery collection (To insert it as the first<\/em> child, use .prepend()<\/code><\/a>). <\/p>\n