overflow hidden show scrollbar code example

Example 1: javascript keep scroll visible

::-webkit-scrollbar {
  -webkit-appearance: none;
  width: 7px;
}
::-webkit-scrollbar-thumb {
  border-radius: 4px;
  background-color: rgba(0, 0, 0, .5);
  -webkit-box-shadow: 0 0 1px rgba(255, 255, 255, .5);
}

Example 2: hide the scrollbar in css if not overflow

.myClass {
  /*auto will remove and add the scroll bar as needed*/
  overflow: auto;
}

Example 3: how to lose overflow in js without hidden

var scrollTop = parseInt($('html').css('top'));
$('html').removeClass('noscroll');
$('html,body').scrollTop(-scrollTop);