Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Catalin R.

Variable for background position

Recommended Posts

Hi,

I need to use a variable for background position. 

TweenMax.set(item, {backgroundPosition: "center myVariable"});

How can I use myVariable for this?

Thanks!

 

Link to comment
Share on other sites

Hello @DevSaver and welcome to the GreenSock Forum!

 

The plus sign (+)  concatenates (joins) the string and the variable.

 

var myVariable = "left";
TweenMax.set(item, {backgroundPosition: "center " + myVariable}); 

 

Happy Tweening!

  • Like 5
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×