I am making a carousel in ReactJS and I don't have to JQuery. I have to slide my carousel smoothly but not using css inbuilt scroll-behaviour = "smooth". Carousel slider function is given below :

I have searched for smooth scrolling but I am getting only vertical scrolling or scrolling using jquery.

let moveSlider = (index, selector) => {
    let w = selector.firstChild.clientWidth;
    let move = index * w;       
    window.requestAnimationFrame(function () {
        selector.scrollTo(currentP, 0);

Expected carousel behavior should be smooth scrolling with given speed without using Jquery. I have tried using some algorithm but failed to implement using scrollTo() method.

0 Answers