vendredi 26 juillet 2019

Jquery Animation Slider

I want to make a slider moving smoothly up and down. How can this be done?

 (scroller).scroll(function(e){

    e.preventDefault();

    var that = $(e.target);

    clearTimeout($.data(this, 'scrollTimer'));
        $.data(this, 'scrollTimer', setTimeout(function() {

           that.scrollTop(slide(that.scrollTop()));     

        }, 200));

})

function slide(s){

    var currentIndex = Math.round(s/600);           
    return 600*currentIndex;
}

Everything crashes after trying the .animate() function...




Aucun commentaire:

Enregistrer un commentaire