Similar Posts

Subscribe
Notify of
3 Answers
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
flyaquarius
1 year ago

The arrow itself with HTML and CSS that it does something with Javascript. Since I’ve done this in my project, I can share my code with you, which might help:

.carousel-button {
  position: absolute;
  z-index: 2;
  width: 48px;
  height: 48px;
  top: calc(50% - 24px);
}

#carousel-left-button {
  left: 8px;
}

#carousel-right-button {
  right: 8px;
}

To scroll with Javascript, get the item that serves as a container and use the scrollBy or scrollTo method.

Element: scrollBy() method – Web APIs | MDN (mozilla.org)

Element: scrollTo() method – Web APIs | MDN (mozilla.org)

Bernhard35
1 year ago

by programming with JavaScript