Jump to content
Search Community

uRmum

Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by uRmum

  1. Hey guys ! I've been trying to make this slider for the couple couple of days without much success. 

    I have a slider and I'm trying to every time it finishes, it goes back to the first image, but it just stays in the same. 

     

    Here is a snippet of my js.

     


    $(".right-arrow").click(function() {
        
        var contentSlides = $('.slider .slide');
        
        var currentSlide = 0,
            tl = new TimelineMax();
        

                tl.fromTo(contentSlides.eq(currentSlide), 0.4, {webkitClipPath: "inset(0 0 0 0)", x: 0}, {webkitClipPath: "inset(0 0 0 100%)", x: 10} );    
                
                if ( currentSlide < contentSlides.length ) 
                {    
                    currentSlide++;
                }
                
        
                else if( currentSlide == (contentSlides.length -1) )
                {
                    currentSlide = 0;
                }
                
                
                tl.fromTo(contentSlides.eq(currentSlide), 0.4, {webkitClipPath: "inset(0 100% 0 0)", x: -40}, {webkitClipPath: "inset(0 0 0 0)", x: 0} )

        
        
    });

     

     

    Thanks in advance

     

×
×
  • Create New...