Skip to main content

Bug Tracker

Side navigation

#1514 closed bug (invalid)

Opened August 18, 2007 01:33AM UTC

Closed August 18, 2007 11:43PM UTC

animate() has 4 params but why is it being called with only 3 in wrong order

Reported by: RghSx Owned by:
Priority: critical Milestone: 1.1.4
Component: core Version: 1.1.3
Keywords: animate slideUp slideDown Cc: john.pangilinan@planetwidegames.com
Blocked by: Blocking:
Description

In 1.1.3.1 version, the animate function I see now takes 4 params - why are the utility functions (''slideUp,slideDown,slideToggle,fadeIn,fadeOut,fadeTo'') seeming to pass only 3 and in the wrong order? Is this an oversight?

animate: function( prop, speed, easing, callback ) //animate function declaration

	slideDown: function(speed,callback){
		return this.animate({height: "show"}, speed, callback);
	},
	slideUp: function(speed,callback){
		return this.animate({height: "hide"}, speed, callback);
	},
	slideToggle: function(speed, callback){
		return this.animate({height: "toggle"}, speed, callback);
	},
	fadeIn: function(speed, callback){
		return this.animate({opacity: "show"}, speed, callback);
	},
	fadeOut: function(speed, callback){
		return this.animate({opacity: "hide"}, speed, callback);
	},
	fadeTo: function(speed,to,callback){
		return this.animate({opacity: to}, speed, callback);
	},

I've put a temporary fix to this by inserting the string 'linear' as the 3rd argument.

	slideDown: function(speed,callback){
		return this.animate({height: "show"}, speed, ''''linear'''', callback);
	},
	slideUp: function(speed,callback){
		return this.animate({height: "hide"}, speed, ''''linear'''', callback);
	},
	slideToggle: function(speed, callback){
		return this.animate({height: "toggle"}, speed, ''''linear'''', callback);
	},
	fadeIn: function(speed, callback){
		return this.animate({opacity: "show"}, speed, ''''linear'''', callback);
	},
	fadeOut: function(speed, callback){
		return this.animate({opacity: "hide"}, speed, ''''linear'''', callback);
	},
	fadeTo: function(speed,to,callback){
		return this.animate({opacity: to}, speed, ''''linear'''', callback);
	},
Attachments (0)
Change History (3)

Changed August 18, 2007 08:28PM UTC by john comment:1

resolution: → invalid
status: newclosed

No, this is correct. The easing argument is optional - so those calls are perfectly ok. (The .animate() function has taken 4 arguments since jQuery 1.1).

Changed August 18, 2007 09:00PM UTC by RghSx comment:2

resolution: invalid
status: closedreopened

I'm sorry but maybe you can explain it to me better, the easing may be an optional param, how can you pass a callback reference as the 3rd param to the animate() function when it's expected to be the 4th argument in the animate(arg1,arg2,arg3,callback)?

Isn't the order important?

Changed August 18, 2007 11:43PM UTC by john comment:3

resolution: → invalid
status: reopenedclosed

The only important aspect is that the callback is the last argument - checks are made in the animate functions (specifically inside the jQuery.speed() function) and the order of the arguments is set. In the future, you could bring up issues like this on the jQuery Dev mailing list:

http://docs.jquery.com/Discussion