1 line
7.0 KiB
JSON
1 line
7.0 KiB
JSON
{"name":"fadeToggle","type":"method","title":".fadeToggle()","deprecated":null,"removed":null,"desc":"Display or hide the matched elements by animating their opacity.","categories":["effects","effects/fading","version/1.4.4"],"entries":[{"return":"jQuery","signatures":[{"added":"1.4.4","argument":[{"desc":"A string or number determining how long the animation will run.","type":[{"name":"Number"},{"name":"String"}],"name":"duration","default":"400","optional":"true"},{"desc":"A string indicating which easing function to use for the transition.","name":"easing","type":"String","default":"swing","optional":"true"},{"desc":"A function to call once the animation is complete.","name":"complete","type":"Function","optional":"true"}]},{"added":"1.4.4","argument":{"desc":"A map of additional options to pass to the method.","property":[{"desc":"A string or number determining how long the animation will run.","type":[{"name":"Number"},{"name":"String"}],"name":"duration","default":"400"},{"desc":"A string indicating which easing function to use for the transition.","name":"easing","type":"String","default":"swing"},{"desc":"A Boolean indicating whether to place the animation in the effects queue. If false, the animation will begin immediately. <strong>As of jQuery 1.7</strong>, the queue option can also accept a string, in which case the animation is added to the queue represented by that string. When a custom queue name is used the animation does not automatically start; you must call <code>.dequeue(\"queuename\")</code> to start it.","type":[{"name":"Boolean"},{"name":"String"}],"name":"queue","default":"true"},{"desc":"A map of one or more of the CSS properties defined by the properties argument and their corresponding easing functions.","name":"specialEasing","type":"PlainObject","added":"1.4"},{"desc":"A function to be called for each animated property of each animated element. This function provides an opportunity to modify the Tween object to change the value of the property before it is set.","argument":[{"desc":"The numeric value of the property being animated at each step","name":"now","type":"Number"},{"desc":"An object of properties related to the animation and the element being animated. For information about the tween object and its properties, see <ahref=\"/jQuery.Tween/\">jQuery.Tween</a>","name":"tween","type":"Tween"}],"name":"step","type":"Function"},{"desc":"A function to be called after each step of the animation, only once per animated element regardless of the number of animated properties.","argument":[{"desc":"An enhanced Promise object with additional properties for the animation","name":"animation","type":"Promise"},{"desc":"A number from 0 to 1 indicating the progress of the animation","name":"progress","type":"Number"},{"desc":"A number indicating the remaining number of milliseconds until the scheduled end of the animation","name":"remainingMs","type":"Number"}],"name":"progress","type":"Function","added":"1.8"},{"desc":"A function to call once the animation is complete.","name":"complete","type":"Function"},{"desc":"A function to call when the animation begins.","argument":{"desc":"An enhanced Promise object with additional properties for the animation","name":"animation","type":"Promise"},"name":"start","type":"Function","added":"1.8"},{"desc":"A function to be called when the animation completes (its Promise object is resolved).","argument":[{"desc":"An enhanced Promise object with additional properties for the animation","name":"animation","type":"Promise"},{"desc":"Indicates whether the animation jumped to the end","name":"jumpedToEnd","type":"Boolean"}],"name":"done","type":"Function","added":"1.8"},{"desc":"A function to be called when the animation fails to complete (its Promise object is rejected).","argument":[{"desc":"An enhanced Promise object with additional properties for the animation","name":"animation","type":"Promise"},{"desc":"Indicates whether the animation jumped to the end","name":"jumpedToEnd","type":"Boolean"}],"name":"fail","type":"Function","added":"1.8"},{"desc":"A function to be called when the animation completes or stops without completing (its Promise object is either resolved or rejected).","argument":[{"desc":"An enhanced Promise object with additional properties for the animation","name":"animation","type":"Promise"},{"desc":"Indicates whether the animation jumped to the end","name":"jumpedToEnd","type":"Boolean"}],"name":"always","type":"Function","added":"1.8"}],"name":"options","type":"PlainObject"}}],"examples":{"desc":"Fades first paragraph in or out, completing the animation within 600 milliseconds and using a linear easing. Fades last paragraph in or out for 200 milliseconds, inserting a \"finished\" message upon completion. ","code":"\n$( \"button:first\" ).click(function() {\n $( \"p:first\" ).fadeToggle( \"slow\", \"linear\" );\n});\n$( \"button:last\" ).click(function() {\n $( \"p:last\" ).fadeToggle( \"fast\", function() {\n $( \"#log\" ).append( \"<div>finished</div>\" );\n });\n});\n","html":"\n<button>fadeToggle p1</button>\n<button>fadeToggle p2</button>\n<p>This paragraph has a slow, linear fade.</p>\n<p>This paragraph has a fast animation.</p>\n<div id=\"log\"></div>\n"},"longdesc":"\n <p>The <code>.fadeToggle()</code> method animates the opacity of the matched elements. When called on a visible element, the element's <code>display</code> style property is set to <code>none</code> once the opacity reaches 0, so the element no longer affects the layout of the page.</p>\n <p>Durations are given in milliseconds; higher values indicate slower animations, not faster ones. The strings <code>'fast'</code> and <code>'slow'</code> can be supplied to indicate durations of <code>200</code> and <code>600</code> milliseconds, respectively.</p>\n <h4 id=\"easing\">Easing</h4>\n <p>The string representing 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 <code>swing</code>, and one that progresses at a constant pace, called <code>linear</code>. More easing functions are available with the use of plug-ins, most notably the <a href=\"http://jqueryui.com\">jQuery UI suite</a>.</p>\n <h4 id=\"callback-function\">Callback Function</h4>\n <p>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 <code>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 <p><strong>As of jQuery 1.6</strong>, the <code><a href=\"/promise/\">.promise()</a></code> method can be used in conjunction with the <code><a href=\"/deferred.done/\">deferred.done()</a></code> method to execute a single callback for the animation as a whole when <em>all</em> matching elements have completed their animations ( See the <a href=\"/promise/#example-1\">example for .promise()</a> ). </p>\n "}]} |