Home > Article > Web Front-end > How to hide scroll bars in JavaScript
Implementation method: 1. Use the "document.body.parentNode.style.overflowY= "hidden";" statement; 2. Use "$("body").parent().css("overflow- y","hidden");" statement.
The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.
JavaScript method to hide the scroll bar:
Implementation code 1:
document.body.parentNode.style.overflowY = "hidden";
Implementation code 2:
$("body").parent().css("overflow-y","hidden");
Extended knowledge:
Enable browser scroll bar (js)
document.body.parentNode.style.overflowY = "auto"; $("body").parent().css("overflow-y","auto");
css hidden scroll bar
::-webkit-scrollbar { width: 0px; }
[Recommended learning: javascript advanced tutorial】
The above is the detailed content of How to hide scroll bars in JavaScript. For more information, please follow other related articles on the PHP Chinese website!