Home  >  Article  >  Web Front-end  >  How to hide scroll bars in JavaScript

How to hide scroll bars in JavaScript

青灯夜游
青灯夜游Original
2021-09-09 15:58:026517browse

Implementation method: 1. Use the "document.body.parentNode.style.overflowY= "hidden";" statement; 2. Use "$("body").parent().css("overflow- y","hidden");" statement.

How to hide scroll bars in JavaScript

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";

How to hide scroll bars in JavaScript

Implementation code 2:

$("body").parent().css("overflow-y","hidden");

How to hide scroll bars in JavaScript

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn