Tazintosh Posted September 15, 2021 Share Posted September 15, 2021 Hi folks, Following the ScrollTrigger.matchMedia() documentation, the parameter is defined like so: {"(min-width: 800px)": function() { ... }, "(max-width: 799px)": function() { ... }} My project use some global variables specific to the client. "800px" is one of them: I would to define my parameter like so but cannot seems to make it work: {"(min-width: " + GLOBAL.theme.width.mediumLarge + ")": function() { ... }} Any way to write such a thing? Thanks in advance for your support. Regards. Link to comment Share on other sites More sharing options...
Solution Tazintosh Posted September 15, 2021 Author Solution Share Posted September 15, 2021 Ok, found the solution: https://stackoverflow.com/questions/11508463/javascript-set-object-key-by-variable Quote If you're able to use ES6 and Babel, you can use this new feature: { [yourKeyVariable]: someValueArray, } 2 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now