Search code examples
javascriptreactjsslidercarouselautoplay

How to hide timer in React Awesome Slider in autoplay


I am using React Awesome Slider with autoplay feature. But when I do that a timer appears on slide changes and wraps the slide item. Although I set showtime: {false}, it doesn't reflect correctly.

import AwesomeSlider from 'react-awesome-slider'
import withAutoplay from 'react-awesome-slider/dist/autoplay'

const AutoplaySlider = withAutoplay(AwesomeSlider)

const MySlider = () => (
  <AutoplaySlider play={true} showTimer={false}>
     <div>1</div>
     <div>2</div>
     <div>3</div>
  </AutoplaySlider>
)

Solution

  • Unfortunately, I couldn't find any solution for this. It seems to be a bug regarding React Awesome Slider. I might send a pull request for this. However, I used CSS to enforce hide the timer.

    .my-slider-class-name .awssld__timer {
        opacity: 0;
        pointer-events: none; /* prevent events (mouse clicking etc.) */
    }
    

    NOTE: When I tried display: none it, slider stopped working.