Jump to content
Search Community

NgAndreas97

Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by NgAndreas97

  1. I've encountered a problem with my start & end position on my ScrollTrigger.

     

    This is how the start and end position should be, and every time I save after writing a code the position is correct. However..

    Before.png

     

    When I refresh the page the start & end position gets buggy. The start & end position does not align with the top and the bottom of the container to the left. 

    After.png

     

    This is the scrollTrigger code

        useEffect(() => {
            const el = cardRef.current
            ScrollTrigger.create({
                trigger : el,
                start : 'top center ',
                end: 'bottom center',
                onEnter : () => {
                    playVideo()
                    store.dispatch(currentElementHover(techNames()))
                    cardRef.current.classList.toggle('cardFocus') 
                },
                onEnterBack : () => {
                    playVideo()
                    store.dispatch(currentElementHover(techNames()))
                    cardRef.current.classList.toggle('cardFocus') 
                },
                onLeave : () => {
                    resetVideo()
                    store.dispatch(currentElementHover([]))
                    cardRef.current.classList.toggle('cardFocus') 
                },
                onLeaveBack : () => {
                    resetVideo()
                    store.dispatch(currentElementHover([]))
                    cardRef.current.classList.toggle('cardFocus') 
                },
                markers : true
            })
        },[])

    Any help would be appreciated greatly!

×
×
  • Create New...