Jump to content
Search Community

Eraze86

Members
  • Posts

    3
  • Joined

  • Last visited

Posts posted by Eraze86

  1.     const tl = gsap.timeline()
        useEffect(() => {
    
            if (isOpen) {
                tl.to([toggle.current], { height: "18rem", ease: "none" })
                tl.to([link.current], { delay: 0.2, opacity: 1 })
            }else{
               console.log("close") 
          
            } 
        }, [isOpen, tl])

    im trying to make my menu open och close in the same way. 
    but at soon as i put any code more then console.log in the else {} it gives me  "Cannot read properties of null"
    i dont understand why? 
    ive tryed tl.reverse and  writing tl.to code but it always gives me the same error. 

    i have also tryed if else, and if(!isOpen) but gives me the same

    Any input? 

     

    the first code works when i press the button to open the meny, 

    i can change it aswell so it only works when i close the button. 

×
×
  • Create New...