InterviewSolution
| 1. |
How Is The Deferred Method In Jquery Important In Relation To Animate Method? |
|
Answer» The .animate() method is used to CREATE animations with other shorthands using it. The queue() method can be used to link TOGETHER multiple animation METHODS to create an unique effect. These methods are effective when all the data is available locally and all the methods are executed on as single system only. In case the user wants to use the animation methods on a data that resides on the server and wants to handle at a single go the user can make used of the .deferred method. For example: var my$ = $.sub(); my$.fn.animate=function(props,SPEED,easing,callback){var options=speed && typeof speed==="object"? jQuery.extend({}, speed) : { complete: callback || !callback && easing || jQuery.isFunction( speed ) && speed, duration: speed, easing: callback && easing || easing && !jQuery.isFunction(easing) && easing }; var dfd = my$.Deferred(), complete = options.complete, count = this.length; options.complete = function() { complete && complete.call( this ); if ( !--count ) { dfd.resolve(); } }; The .animate() method is used to create animations with other shorthands using it. The queue() method can be used to link together multiple animation methods to create an unique effect. These methods are effective when all the data is available locally and all the methods are executed on as single system only. In case the user wants to use the animation methods on a data that resides on the server and wants to handle at a single go the user can make used of the .deferred method. For example: |
|