Custom design & native functionality
The plugin combines the features of native scrolling
(e.g. hotkeys, speed, smoothness, touchsupport etc.) and custom HTML & CSS. It does not replace the native scrollbars, it just hides them to guarantee 100% native scrolling. It also provides additional and highly customizable DOM elements to style your own scrollbars.
To check how flexible the styling is, take a look at the examples in the styling demo.
Supports all css size affecting properties
Supported are all size properties (width, height, max-*, min-*)
with all units (em, ex, %, px, cm, mm, in, pt, pc, rem).
Even height: auto and width: auto in combination with min-* and max-* size properties.
Floating elements in combination with width: auto are supported too.
The best thing is, any size, padding, margin or border-width changes are detected automatically by the plugin.
Please use the capabilities demo to convince yourself.
Extended support for textarea elements
Textarea elements have extended support.
Dependent on your options, textareas can have dynamic width and height. Which means the size of the textarea is dependent of its content.
For more information please read the documentation to the textarea options or check out the textarea demo.
No-auto-wrapping (wrap="off") textareas are also supported.
Extended RTL support
Every browser handles RTL scrolling differently. The plugin leaves it up to you whether you want to use the native RTL scroll behavior which differs in each browser or a "normalized" RTL scroll behavior, which works the same way in every browser.
Extremely powerful scroll method
The plugin offers a scroll method which supports animated scrolling. With this method you can scroll to absolute, relative and calculated coordinates. It's also possible to scroll directly to a passed DOM element. Furthermore it provides the same functionality as the native scrollIntoView method. Try the demo or read the documentation for more info.
Supports Extensions for simple customization
In case OverlayScrollbars doesn't support a feature you need, you are able to develop or use extensions. Extensions provide additional functionality to the plugin, to support special or personal cases. The extension-system is simple and powerful. Please read the documentation for more info and check the extensions page to see all official extensions.
Using modern web technologies
The Web has many useful tools which are only supported in modern browsers. The plugin is using them in modern browsers to ensure maximum performance but uses fallbacks in older browsers to ensure functionality.
Able to hide all types of scrollbars
Similar plugins are not able to hide natively overlaid scrollbars. These are standard on all mobile browsers as well as on many Linux operating systems and MacOS.
Moreover it's even possible to hide mixed scrollbars (e.g. vertical scrollbar is overlaid and horizontal isn't) but this case can only happen if your browser is using some skin or theme plugins.
No clipping without overflow
As long as there is no overflow, the element is not clipped. The clip appears only if a overflow exists.
You can not achieve this with CSS because all overflow values except of overflow: visible clips the element even if the element has no overflow.
Component wrapper for popular frameworks
If you are using popular component-based web front-end frameworks such as React, Vue or Angular, you can use the corresponding component wrapper.
box-sizing: border-box and box-sizing: content-box.npm install overlayscrollbars
jquery..<html>
<head>
<!-- Plugin CSS -->
<link type="text/css" href="path/to/OverlayScrollbars.css" rel="stylesheet"/>
<!-- Plugin JS -->
<script type="text/javascript" src="path/to/OverlayScrollbars.js"></script>
</head>
<body>
</body>
</html>
<html>
<head>
<!-- Plugin CSS -->
<link type="text/css" href="path/to/OverlayScrollbars.css" rel="stylesheet"/>
<!-- jQuery JS -->
<script type="text/javascript" src="path/to/jquery.js"></script>
<!-- Plugin JS -->
<script type="text/javascript" src="path/to/jquery.overlayScrollbars.js"></script>
</head>
<body>
</body>
</html>
document.addEventListener("DOMContentLoaded", function() {
//The first argument are the elements to which the plugin shall be initialized
//The second argument has to be at least a empty object or a object with your desired options
OverlayScrollbars(document.querySelectorAll("body"), { });
});
For further and more detailed information about the initialization and the initialization possibilities please read this section in the documentation.$(function() {
//The passed argument has to be at least a empty object or a object with your desired options
$("body").overlayScrollbars({ });
});
For further and more detailed information about the initialization and the initialization possibilities please read this section in the documentation.npm install @types/overlayscrollbars
I recommend setting these options in your tsconfig.json:
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"esModuleInterop": true
}
}