- The onscroll event is used to disable the scroll bar.
- The onscroll event acts as soon as the page is scrolled. So, setTimeout() method is used to provide a delay to hide the scroll bar, so that we are able to scroll down first.
- The time can be adjusted according to our requirement.
- onmousemove event is used to enable scrolling as soon as the mouse pointer is moved. onclick event is used to enable scrolling as soon as the user clicks. onmousewheel event is used to enable scrolling as soon as the page is scrolled down. Thus, these events help us to enable scrolling when the page becomes active again.
Example 2: This example hides the scrollbar on the image.
The main disadvantage of hiding the scroll bar for inactivity is that as soon as the scrollbar hides, the contents of the body ‘jump’ to fill up the space that was occupied by the scrollbar. Thus, it does not appear very appealing to the user.
- Hide scroll bar, but while still being able to scroll using CSS
- Difference between self::$bar and static::$bar in PHP
- How to hide an element when printing a web page using CSS?
- jQuery | Hide/Show, Toggle and Fading methods with Examples
- Hide or show elements in HTML using display property
- jQuery | hide() with Examples
- Image Replacement in Bootstrap using text-hide Class
- AngularJS | ng-hide Directive
- How to hide a div when the user clicks outside of it using jQuery?
- How to hide div element after few seconds in jQuery ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : shs_