M
M
Mad Coder2021-02-01 00:36:41
React
Mad Coder, 2021-02-01 00:36:41

Slider for React?

Prompt slider with custom scroll width. I mean that when we click on the arrow (or drag the mouse), we scroll the whole picture (for example). I need that when I click on the arrow (or drag the mouse), the picture or content scrolls exactly by the width, depending on the duration of the arrow click (or depending on how much I dragged the picture with the mouse). So that the whole picture does not scroll. Like a running strip, but a slider.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sashabeep, 2021-02-01
@polyak-y

Offhand, I remember similar behavior in both Owl (freeDrag) and swiper (Freemode).

S
SomeSmallThings, 2021-02-01
@SomeSmallThings

It is unlikely that you will find a universal solution out of the box, you can try:

  • react-ticker , there are usage examples in the description. Specifically for your task, you will need to wrap it in a parent component that will control the state of the slider through props.
  • jquery implementation.
  • Take any popular carousel library, where on mouseUp controls, launch an interval that will scroll the carousel to some offset once every N time, clear the interval on mouseDown (or measure the time if you need delayed scrolling).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question