jQuery Home

Effects

hide() and show()

The hide() and show() methods will hide and reveal HTML elements.


Hide Speed Parameter

The optional speed parameter specifies the speed of the hiding.


toggle()

You can also toggle between hiding and showing an element with the toggle() method.


fadeIn()

The following example demonstrates the fadeIn() method with different speed parameters.


fadeOut()

The following example demonstrates the fadeOut() method with different parameters.


fadeToggle()

The jQuery fadeToggle() method toggles between the fadeIn() and fadeOut() methods.


fadeTo()

The required opacity parameter in the fadeTo() method specifies fading to a given opacity (value between 0 and 1).


slideDown()

The jQuery slideDown() method is used to slide down an element.


slideUp()

The jQuery slideUp() method is used to slide up an element.


slideToggle()

The jQuery slideToggle() method toggles between the slideDown() and slideUp() methods.


animate()

The jQuery animate() method is used to create custom animations.

The following example demonstrates a simple use of the animate() method; it moves a <div> element to the right, until it has reached a left property of 250px.


Multiple properties can be animated at the same time.


stop()

The jQuery stop() method is used to stop an animation or effect before it is finished.


Callback Functions

The example below has a callback parameter that is a function that will be executed after the hide effect is completed.


The example below has no callback parameter, and the alert box will be displayed before the hide effect is completed.


Chaining

To chain an action, you simply append the action to the previous action.


queue() Methods

The method can be used to see how many items are in the queue.



The dequeue() method removes the next function from the queue, and then executes the function.



The clearQueue() method removes all items from the queue that have not yet been run.


The delay() method sets a timer to delay the execution of the next item in the queue.


The finish() method stops the currently-running animations, removes all queued animations, and completes all animations for the selected elements.