Jump to content
Search Community

Clearly Vinay

Members
  • Posts

    8
  • Joined

  • Last visited

Posts posted by Clearly Vinay

  1. I copy pasted this bit into my Gatsby project and the page won't even scroll ! I don't get what in doing wrong ughhh 

     

    useEffect(() => {
    const isSSR = typeof window === "undefined"
    if(!isSSR) {
     
    let scrollPositionX = 0,
    scrollPositionY = 0,
    bodyScrollBar = Scrollbar.init(document.querySelector('#my-scrollbar'));
     
    bodyScrollBar.addListener(({ offset }) => {
    scrollPositionX = offset.x;
    scrollPositionY = offset.y;
    });
     
    bodyScrollBar.setPosition(0, 0);
    bodyScrollBar.track.xAxis.element.remove();
    gsap.registerPlugin(ScrollTrigger);
    ScrollTrigger.scrollerProxy("body", {
    scrollTop(value) {
    if (arguments.length) {
    bodyScrollBar.scrollTop = value;
    }
    return bodyScrollBar.scrollTop;
    }
    });
     
    bodyScrollBar.addListener(ScrollTrigger.update);
     
    }
    }, []);
     
    useEffect(() => {
     
    gsap.to('body', 0, {css: {visibility: 'visible'}});
     
    const tl = gsap.timeline();
     
    tl.from('.line span',1.6, { y: 400,ease: Power3.easeOut,delay: .2,skewY: 7,stagger: { amount: 0.3 },})
    .from('.line_small span',1.2, { y: 100,ease: Power3.easeOut,
    delay: .2,skewY: 7,stagger: { amount: 0.3 }}, .1)
    ;
     
    gsap.registerPlugin(ScrollTrigger);
    gsap.to('.image_float', {
    scrollTrigger: {
    trigger: '.h_trigger',
    start: '-100px top',
    end:'bottom top',
    scrub: .1,
    id: 'image-float'
    },
    y: -50,
    ease: 'none',
    duration: 2
    });
    gsap.to('.line', {
    scrollTrigger: {
    trigger: '.h_trigger',
    start: '-100px top',
    end:'center top',
    scrub: .1,
    id: 'lines'
    },
    y: -50,
    ease: 'none',
    duration: 2
    });
     
    }, [])


     
    return (

     

    sorry, I've got some other things there but I guess this is it:

     

     
    useEffect(() => {
    const isSSR = typeof window === "undefined"
    if(!isSSR) {
     
    let scrollPositionX = 0,
    scrollPositionY = 0,
    bodyScrollBar = Scrollbar.init(document.querySelector('#my-scrollbar'));
     
    bodyScrollBar.addListener(({ offset }) => {
    scrollPositionX = offset.x;
    scrollPositionY = offset.y;
    });
     
    bodyScrollBar.setPosition(0, 0);
    bodyScrollBar.track.xAxis.element.remove();
    gsap.registerPlugin(ScrollTrigger);
    ScrollTrigger.scrollerProxy("body", {
    scrollTop(value) {
    if (arguments.length) {
    bodyScrollBar.scrollTop = value;
    }
    return bodyScrollBar.scrollTop;
    }
    });
     
    bodyScrollBar.addListener(ScrollTrigger.update);
     
    }
    }, []);
×
×
  • Create New...