1/* Hide scrollbar for Chrome, Safari and Opera */
2.example::-webkit-scrollbar {
3 display: none;
4}
5
6/* Hide scrollbar for IE and Edge */
7.example {
8 -ms-overflow-style: none;
9}
1// You can hide the document scrollbar with this...
2document.body.style.overflow = 'hidden';
3//...and unhide it with this:
4document.body.style.overflow = 'visible';
5
6// Or switch between them:
7booleanCondition
8 ? document.body.style.overflow = 'hidden'
9 : document.body.style.overflow = 'visible';
1function HideScrollbar() {
2 var style = document.createElement("style");
3 style.innerHTML = `body::-webkit-scrollbar {display: none;}`;
4 document.head.appendChild(style);
5}