Disable Scrolling jQuery disableScroll - Download Disable Body/Content Scrolling With jQuery - disableScroll

Download Disable Body/Content Scrolling With jQuery – disableScroll

Posted on

This time I will share jQuery Plugin and tutorial about Disable Body/Content Scrolling With jQuery – disableScroll, hope it will help you in programming stack.

Disable Scrolling jQuery disableScroll - Download Disable Body/Content Scrolling With jQuery - disableScroll
File Size: 5.94 KB
Views Total: 7176
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

disableScroll is a very small jQuery plugin allows to temporarily disable the scrolling behaviors triggered by Mouse, Touch and Keypress events.

How to use it:

1. Include the jquery.disablescroll.js after jQuery library and the disableScroll plugin is ready for use.

1 <script-src="//code.jquery.com/jquery.min.js"></script>
2 <script-src="jquery.disablescroll.js"></script>

2. The JavaScript to prevent scroll events when you scroll a scollable element as this:

1 var $nonScrollable = $("#myElement");
2 $nonScrollable.disablescroll();

3. If you want to re-enable the scroll events in the scrollable element:

1 $nonScrollable.disablescroll("undo");

4. Plugin’s options to enable/disable the trigger events.

1 var $nonScrollable = $("#myElement");
2 $nonScrollable.disablescroll({
3   handleWheel : true,
4   handleScrollbar: true,
5   handleKeys : true,
6   // spacebar: 32, pageup: 33, pagedown: 34, end: 35, home: 36
7   // left: 37, up: 38, right: 39, down: 40
8   scrollEventKeys : [32, 33, 34, 35, 36, 37, 38, 39, 40]
9 });

This awesome jQuery plugin is developed by realjoshharrison. For more Advanced Usages, please check the demo page or visit the official website.

source : jqueryscript.net