hide scrollbar js but still scroll code example

Example 1: css hide scrollbar but allow scroll

html {
  overflow:   scroll;
}
::-webkit-scrollbar {
    width: 0px;
    background: transparent; /* make scrollbar transparent */
}

Example 2: javascript hide scrollbar

// You can hide the document scrollbar with this...
document.body.style.overflow = 'hidden';
//...and unhide it with this:
document.body.style.overflow = 'visible';

// Or switch between them:
booleanCondition
  ? document.body.style.overflow = 'hidden'
  : document.body.style.overflow = 'visible';

Tags:

Css Example