Jitender
Jitender

Reputation: 7969

can we store fadeOut method in a variable

i have a jquery slider function and i want to customize it. my requirement is i want store fadeout effect in variable but i am not getting any idea. i spent some time on the internet to find out the solutions but not reaching up to the solutions. so there is any solutions regarding this. if yes please let me know it will be very helpful for me.

var mYname=fadeOut(500)

or

if (option[12]/*prevNext*/) eA[fadeOpacity ? 'fadeIn' : 'fadeOut' ](fadetime);

Upvotes: 0

Views: 73

Answers (1)

Yogesh Khatri
Yogesh Khatri

Reputation: 1210

you don't have to save the fadeOut function in a variable if your requirement is only for that line, so you can change your line to

if (option[12]/*prevNext*/) fadeOpacity ? fadeIn(fadetime) : fadeOut(fadetime);

or if you want to store the function in a variable, then you just have to assign the function name to the variable. The way you were doing in the question will call the function and will assign the return value to the variable, instead you can do it as

var mYname=fadeOut;

and then you can use it to call like

mYname(500);

Upvotes: 1

Related Questions