CreativelyCoded
CreativelyCoded

Reputation: 197

How to pass multiple variables?

I have a variable:

var options = {'transition-duration': dataspeed + 'ms',
'transition-timing-function': dataeasing, 
'transition-delay': datadelay + 'ms'};

Then I'm trying to use this variable in:

$(this).css({'opacity':'1'}, options);

The opacity works fine but the variable options are not passed.

Upvotes: 1

Views: 53

Answers (2)

Felix Kling
Felix Kling

Reputation: 816252

You can also merge both objects:

$(this).css($.extend({'opacity':'1'}, options));

Upvotes: 0

Satpal
Satpal

Reputation: 133403

Simply use

 $(this).css({'opacity':'1'}).css(options);

Upvotes: 4

Related Questions