Home > Web Front-end > Front-end Q&A > How to hide scroll bars in JavaScript

How to hide scroll bars in JavaScript

青灯夜游
Release: 2023-01-11 09:19:00
Original
6752 people have browsed it

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";
Copy after login

How to hide scroll bars in JavaScript

Implementation code 2:

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

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");
Copy after login

css hidden scroll bar

::-webkit-scrollbar {
	width: 0px;
}
Copy after login

[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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template