0

I am trying to create a horizontal scroller, which can be controlled both ways,

  1. By arrows
  2. By a mouse or touch scroll

Both are done, but there is one problem which I am trying to achieve but couldn't understand how to do it.

I want to trigger a function on horizontal scroll so that I can hide and unhide the arrow button by scrolling with mouse and touch scroll too. How can I do that? or any other way?

horizontal Scroller, here is the code of horizontal scroller, which I have achieved yet

Any type of help will be appreciated. Thank You!

2 Answers 2

1

The way I have achieved this is using the onScroll synthetic event from React onScroll to hide the arrows when scrolling and then calling a setTimeout when to display the arrows when the scrolling stops.

Example here: Code Sandbox

Sign up to request clarification or add additional context in comments.

Comments

0

The final code of the horizontal scroller is here, Horizontal Scroller

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.