I’m trying to set the background color of a target (#target) to be the background color of a trigger (#trigger) on mouseover, using GSAP To.
Here’s my setup:
Event:
On MouseEnter
Select Element(s) (Trigger):
#trigger
“all elements with this selector”
Console Log
“event”
Action:
GSAP To
Action Settings:
Target Element - Custom (Document QuerySelectorAll)
#target
JavaScript Object:
{ backgroundColor : trigger.style.backgroundColor}
I get the console event, so the trigger is working fine, but the target doesn’t change.
If I change the Javascript object to: { backgroundColor : “red” } then everything works fine, and the target turns red when I mouseOver the trigger.
Can I access both the trigger and the target in one action?
Any help would be massively appreciated. I feel like the answer is just out of reach!
Thanks!