JSFiddle - React, Tailwind, and code Playground

by Baliga

HTML

<div id="container">
  <img class="image" src="https://streamdata.io/wp-content/uploads/2018/04/stack-overflow-orange.png">
  <img class="image" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcScZ51RNyVfUEnqQECgs-S-lzgCCA64GCIwtcHmvBwGw6hjgPL29A">
  <img class="image" src="https://streamdata.io/wp-content/uploads/2018/04/stack-overflow-orange.png">
  <img class="image" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcScZ51RNyVfUEnqQECgs-S-lzgCCA64GCIwtcHmvBwGw6hjgPL29A">
  <img class="image" src="https://streamdata.io/wp-content/uploads/2018/04/stack-overflow-orange.png">
  <img class="image" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcScZ51RNyVfUEnqQECgs-S-lzgCCA64GCIwtcHmvBwGw6hjgPL29A">
  <img class="image" src="https://streamdata.io/wp-content/uploads/2018/04/stack-overflow-orange.png">
</div>

CSS

#container {
  position: absolute;
  left: 2%;
  top: 2%;
  width: 10%;
  height: 90%;
  border: 2px solid black;
  overflow-x: hidden;
  overflow-y: scroll;
}

.image {
  width: 100%;
  margin-bottom: 10%;
}

#container {
  -ms-overflow-style: none;
  overflow: -moz-scrollbars-none;
  transition: all 0.3s;
}

#container::-webkit-scrollbar {
  display: none;
}

JavaScript

$("#container").on("scroll", function(e) {
  if (e.target.scrollHeight - e.target.scrollTop === e.target.clientHeight) {
    $(this).scrollTop(0)
  }
  console.log("e.target.scrollHeight",e.target.scrollHeight);
  console.log("e.target.scrollTop",e.target.scrollTop);
  console.log("e.target.clientHeight",e.target.clientHeight);
})