Latest web development tutorials

jQuery Callback Methods

Callback functions are executed after the current animation 100% complete.


Problems jQuery animation

Many jQuery function relates to animations. These functions will probablyspeedordurationas an optional parameter.

Examples: $ ( "p") hide ( "slow").

speedordurationparameters can be set to many different values, such as "slow", "fast", "normal" , or milliseconds.

Examples

The following examples in the full realization of the effect of hiding the callback function:

Examples of the use of callback

$ ( "Button"). Click (function () {$ ( "p"). Hide ( "slow", function () { alert ( "The paragraph is now hidden ");});});

try it

The following examples are no callback function, a warning box will pop up before the completion of the hidden effect:

No callback (callback)

$ ( " button " ) . click ( function ( ) { $ ( " p " ) . hide ( 1000 ) ; alert ( " The paragraph is now hidden " ) ; } ) ;

Online examples >>