Hi everyone!
(I can't make a codepen 'cause the problem is in Wordpress).
I've been using GSAP a lot lately and it has made our websites a lot cooler!
My employer uses the Wordpress theme Divi (https://www.elegantthemes.com/), this way we have a web designer that can make a website quickly and whenever Divi lacks something the designer wants, I come in and make it work within Divi.
So lately I've been adding a lot of GSAP animations and they work perfectly, But I've stumbled upon a problem. The Divi theme itself also offers some scroll effects, like fading in and out or rotating or scaling and so on. I had made this animation https://code.reddstone.nl/hover-effecten/hover-in-mijn-broekje/ and it works pretty well, but now that we added it to a website we're building that also uses Divi's scroll effects, those scroll effects stopped working.
I think Divi also uses GSAP or something very simular and my timeline is stopping Divi's from working. How can I make sure there's no conflict between the animations?
I know it's not much to go on, but I hope someone can help me with it.
Here's my code.
let tl = gsap.timeline();
var image = $(".image-div");
window.addEventListener("mousemove", moveImages);
function moveImages(e) {
var xMove = e.clientX / 35;
var yMove = e.clientY / 35;
TweenLite.to(".layer-1", 0.2, {
x: xMove,
y: yMove
});
TweenLite.to(".layer-2", 0.8, {
x: xMove,
y: yMove
});
}
gsap.set(".layer-1", {autoAlpha: 0, scale: 2});
gsap.set(".layer-2", {autoAlpha: 0, scale: 2});
tl.to(".layer-1", {duration: 2.5, autoAlpha: 1, scale:1})
tl.to(".layer-2", {duration: 2, autoAlpha: 1, scale: 1, delay: -1.5})