How to disable scrollbar without hiding using jQuery ? Last Updated : 28 Nov, 2019 Comments Improve Suggest changes Like Article Like Report A vertical or horizontal bar that is located at the corners of the page helps us to scroll the pages or containers upwards, downwards or sideways. So, the process is to disable the scroll bar but the scroll bar should be visible. In this article, we will disable the scroll bar by using .on() function. With the click of the button, we will make the scroll-bar visible but disable. Disable using jQuery with a button: Here once we disable the scroll event the scroll won't work whether we want to make the scrollbar visible or not. We gonna trigger the disable function with the click of the button. Syntax: $(“selector”).on(event, function) Example: This example illustrates the approach of disabling the scroll using visibility. html <!DOCTYPE html> <html> <head> <title> How to disable scrollbar without hiding using jQuery? </title> <script src= "https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"> </script> <script> // On click of button the scroll // gets disabled, still visible. $(document).ready(function() { $("button").click(function() { $("p").text("Scroll-bar is disabled" + " but still visible.") $('#element').on("mousewheel touchmove", function(e) { e.preventDefault(); }); }); }); </script> <style> /*visible active scrollbar*/ #element { height: 150px; width: 400px; border: 2px solid black; overflow: scroll; } </style> </head> <body> <center> <h1 style="color: green">GeeksforGeeks</h1> <h3>A Computer Science portal for Geeks</h3> <div id="element"> <b style="font-size:26px;">jQuery:</b> <article style="font-size:18px; text-align:left;"> jQuery is an open source JavaScript library that simplifies the interactions between an HTML/CSS document, or more precisely the Document Object Model (DOM), and JavaScript. Elaborating the terms, jQuery simplifies HTML document traversing and manipulation, browser event handling, DOM animations, Ajax interactions, and cross-browser JavaScript development. </article> </div> <br> <button>Click</button> <p style="color:red"></p> </center> </body> </html> Output: Before clicking the button scroll is working: After clicking the button scroll is not working: Note: Mouse scroll is disabled but if you click scroll down or up button, the frame will shift. Comment More infoAdvertise with us Next Article How to disable scrollbar without hiding using jQuery ? T Tejashwi5 Follow Improve Article Tags : Web Technologies JQuery jQuery-Misc Similar Reads How to disable a jQuery-ui draggable of widget ? In this article, we will see how to disable draggable widget using jQuery-ui. The jQuery UI consists of GUI widgets, visual effects, and themes implemented using HTML, CSS, and jQuery. jQuery UI is great for building UI interfaces for the webpages. The jQuery UI Draggable disabled Option is used to 1 min read How to Hide Scrollbar with CSS Hiding the scrollbar with CSS can enhance the look of your webpage by removing visible scrollbars while still allowing users to scroll through content. This can create a cleaner, more streamlined user interface without sacrificing usability. In this article, weâll explore different methods for hidin 3 min read How to display scroll update when scrolling down the page using jQuery ? In this article, we will learn to show scroll updates when scrolling down on a webpage. The scroll() event handler can be used to detect any scrolling in the page, but we only need to detect the scrolling down. The scroll down event can be handled using the scroll() and scrollTop() events.HTML DOM W 2 min read How to Disable Scrolling Temporarily using JavaScript? Disabling scrolling temporarily using JavaScript means preventing users from scrolling a webpage during specific interactions, such as when a modal is open or a loading screen is displayed. Scrolling can be disabled using JavaScript using 2 methods:Table of ContentUsing window.onscroll functionSetti 2 min read How to disable a jQuery UI menu? In this article we will disable a jQuery UI menu Syntax: $(".selector").menu( "disable" );Learn more about selectors and menu options in jQuery. Approach: First, add jQuery UI scripts needed for your project. <link href = "https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css" rel = 1 min read jQWidgets jqxScrollBar disabled Property jQWidgets is a JavaScript framework for making web-based applications for PC and mobile devices. It is a very powerful, optimized, platform-independent, and widely supported framework. The jqxScrollBar is used for representing a jQuery widget that provides a scroll bar that has a sliding thumb whose 2 min read jQuery Mobile Navbar disabled Option jQuery Mobile is a web-based technology used to make responsive content that can be accessed on all smartphones, tablets, and desktops. In this article, we will be using the jQuery Mobile Navbar disabled option to disable the Navbar widget. Syntax: Initializing the navbar with the specified disabled 2 min read jQuery UI Slider disabled Option jQuery UI consists of GUI widgets, visual effects, and themes implemented using jQuery, CSS, and HTML. jQuery UI is great for building UI interfaces for the webpages. jQuery UI provides us a slider control through the slider widget. Slider helps us to get a certain value using a given range. In this 2 min read jQuery Mobile Popup Widget disabled Option jQuery Mobile is a web-based technology used to make responsive content that can be accessed on all smartphones, tablets, and desktops. In this article, we will be using the jQuery Mobile Popup Widget disabled Option is used to disable the popup option. It accepts the boolean value i.e. true to disa 1 min read jQuery Mobile Toolbar disabled Option jQuery Mobile is a web-based technology used to make responsive content that can be accessed on all smartphones, tablets, and desktops. In this article, we will use the jQuery Mobile Toolbar disabled option to disable the toolbar. Syntax: Initializing the toolbar with the specified disabled option: 1 min read Like