hide scroll bar and show scroll bar in css code example
Example 1: hide scrollbar css
.scrollbar-hidden::-webkit-scrollbar {
display: none;
}
.scrollbar-hidden {
-ms-overflow-style: none;
scrollbar-width: none;
}
Example 2: css hide scrollbar
// Sass Mixing
@mixin hideScrollbar {
&::-webkit-scrollbar {
width: 0 !important
}
-ms-overflow-style: none;
scrollbar-width: none;
}
Example 3: 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';