Jump to content
Search Community

Ponz

Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by Ponz

  1. Hi!


    I found this code and I immediately tried to use it in my project because it was exactly what I needed.. it wasn't easy to implement gsap in Elementor but it seems to me it works well enough except for a strange behavior at the end of the scroll.. could you help me to solve this?..

     

    my site

     

    my code is:

    <script>
    	;(function(){
    			var chck_if_gsap_loaded = setInterval(function(){
    			if(window.gsap && window.ScrollTrigger){
    					gsap.registerPlugin( ScrollTrigger );
    					myfunction();
    					clearInterval(chck_if_gsap_loaded);
    					}
    			}, 500);
    			
    			function myfunction(){
    
    				
    let cont = document.querySelector("#container");
    gsap.to(".slide", {
      ease: "none",
      x: () => -(cont.scrollWidth - window.innerWidth),
      scrollTrigger: {
        trigger: cont,
        pin: cont,
        start: "center center",
        end: () => "+=" + (cont.scrollWidth - window.innerWidth),
        scrub: true,
        invalidateOnRefresh: true,
        markers: true,
      }
    });
    				
    			}
    })();
    
    </script>

     

×
×
  • Create New...