Sherlok Posted June 15, 2023 Share Posted June 15, 2023 Hello, The example is located here https://codesandbox.io/s/serene-lena-5o2lhi?file=/src/App.js. When the width suitable for desktop the hover animation plays well. But I want to turn the animation for mobile devices. So, on mobile devices I got Cannot read properties of undefined (reading 'play'). I try to reset timeline or use kill but it doesn't work for me. What is the best way to do it? Thanks Link to comment Share on other sites More sharing options...
Solution Rodrigo Posted June 15, 2023 Solution Share Posted June 15, 2023 Hi, Just a syntax error: // Syntax in the breakpoint here mm.add("max-width: 1023px", () => { tlMainLogoRef.current = gsap .timeline({ paused: true }) .to(".mainLogo", { rotate: 0, scale: 0 }, "<"); }); You forgot the parenthesis around the breakpoint: mm.add("(max-width: 1023px)", () => { tlMainLogoRef.current = gsap .timeline({ paused: true }) .to(".mainLogo", { rotate: 0, scale: 0 }, "<"); }); Happy Tweening! Link to comment Share on other sites More sharing options...
Sherlok Posted June 15, 2023 Author Share Posted June 15, 2023 Thanks, @Rodrigo 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