mirror of
https://github.com/tenrok/OverlayScrollbars.git
synced 2026-06-19 12:40:37 +03:00
improve website and reamde
This commit is contained in:
@@ -1,6 +1,3 @@
|
|||||||
|
|
||||||
> OverlayScrollbars is a javascript scrollbar plugin that hides native scrollbars, provides custom styleable overlay scrollbars and keeps the native functionality and feeling.
|
|
||||||
|
|
||||||
## Why
|
## Why
|
||||||
|
|
||||||
I created this plugin because I hate ugly and space consuming scrollbars. Similar plugins haven't met my requirements in terms of features, quality, simplicity, license or browser support.
|
I created this plugin because I hate ugly and space consuming scrollbars. Similar plugins haven't met my requirements in terms of features, quality, simplicity, license or browser support.
|
||||||
@@ -23,7 +20,7 @@ I created this plugin because I hate ugly and space consuming scrollbars. Simila
|
|||||||
|
|
||||||
## Getting started
|
## Getting started
|
||||||
|
|
||||||
#### npm & Node
|
### npm & Node
|
||||||
OverlayScrollbars can be downloaded from [npm](https://www.npmjs.com/package/overlayscrollbars) or the package manager of your choice:
|
OverlayScrollbars can be downloaded from [npm](https://www.npmjs.com/package/overlayscrollbars) or the package manager of your choice:
|
||||||
```sh
|
```sh
|
||||||
npm install overlayscrollbars
|
npm install overlayscrollbars
|
||||||
@@ -34,11 +31,13 @@ import 'overlayscrollbars/overlayscrollbars.css';
|
|||||||
import { OverlayScrollbars } from 'overlayscrollbars';
|
import { OverlayScrollbars } from 'overlayscrollbars';
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Manual download & embedding
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>
|
<summary>
|
||||||
<h6>Manual download & embedding</h6>
|
These instructions are for old stacks. Click here to read them.
|
||||||
</summary>
|
</summary>
|
||||||
|
<br />
|
||||||
|
|
||||||
You can use OverlayScrollbars without any bundler or package manager.
|
You can use OverlayScrollbars without any bundler or package manager.
|
||||||
Simply download it from the [Releases](https://github.com/KingSora/OverlayScrollbars/releases) or use a [CDN](https://cdnjs.com/libraries/overlayscrollbars).
|
Simply download it from the [Releases](https://github.com/KingSora/OverlayScrollbars/releases) or use a [CDN](https://cdnjs.com/libraries/overlayscrollbars).
|
||||||
@@ -71,10 +70,14 @@ const osInstance = OverlayScrollbars(document.querySelector('#myElement'), {});
|
|||||||
If you initialize OverlayScrollbars it needs a few milliseconds to create and append all the elements to the DOM.
|
If you initialize OverlayScrollbars it needs a few milliseconds to create and append all the elements to the DOM.
|
||||||
While this period the native scrollbars are still visible and are switched out after the initialization is finished. This is perceived as flickering.
|
While this period the native scrollbars are still visible and are switched out after the initialization is finished. This is perceived as flickering.
|
||||||
|
|
||||||
|
To fix this behavior apply the `data-overlayscrollbars=""` attribute to the target element (and `html` element if the target element is `body`).
|
||||||
|
|
||||||
|
### Initialization with an Object
|
||||||
<details>
|
<details>
|
||||||
<summary>
|
<summary>
|
||||||
<h6>Initialization with an Object</h6>
|
This is a in depth topic. Click here to read it.
|
||||||
</summary>
|
</summary>
|
||||||
|
<br />
|
||||||
|
|
||||||
> __Note__: For now please refer to the <b>TypeScript definitions</b> for a more detailed description of all possibilities.
|
> __Note__: For now please refer to the <b>TypeScript definitions</b> for a more detailed description of all possibilities.
|
||||||
|
|
||||||
@@ -142,10 +145,12 @@ OverlayScrollbars(document.querySelector('#myElement'), {
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Options in depth
|
||||||
<details>
|
<details>
|
||||||
<summary>
|
<summary>
|
||||||
<h6>Options in depth</h6>
|
This is a in depth topic. Click here to read it.
|
||||||
</summary>
|
</summary>
|
||||||
|
<br />
|
||||||
|
|
||||||
The default options are:
|
The default options are:
|
||||||
```js
|
```js
|
||||||
@@ -319,10 +324,13 @@ OverlayScrollbars(document.querySelector('#myElement'), {}, {
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Events in depth
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>
|
<summary>
|
||||||
<h6>Events in depth</h6>
|
This is a in depth topic. Click here to read it.
|
||||||
</summary>
|
</summary>
|
||||||
|
<br />
|
||||||
|
|
||||||
> __Note__: Every event receives the `instance` from which it was invoked as the first argument. Always.
|
> __Note__: Every event receives the `instance` from which it was invoked as the first argument. Always.
|
||||||
|
|
||||||
@@ -408,9 +416,9 @@ Everything thats considered not core functionality or old browser compatibility
|
|||||||
- **SizeObserverPlugin**: Is needed for old browsers which aren't supporting the `ResizeObserver` api. [You can find the list of browsers where you need this plugin here](https://caniuse.com/?search=ResizeObserver)
|
- **SizeObserverPlugin**: Is needed for old browsers which aren't supporting the `ResizeObserver` api. [You can find the list of browsers where you need this plugin here](https://caniuse.com/?search=ResizeObserver)
|
||||||
- **ClickScrollPlugin**: If you want to use the option `scrollbars: { clickScroll: true }`.
|
- **ClickScrollPlugin**: If you want to use the option `scrollbars: { clickScroll: true }`.
|
||||||
|
|
||||||
#### Consuming Plugins
|
### Consuming Plugins
|
||||||
|
|
||||||
You can consume plugins like:
|
Plugins are consumed like:
|
||||||
```ts
|
```ts
|
||||||
import {
|
import {
|
||||||
OverlayScrollbars,
|
OverlayScrollbars,
|
||||||
@@ -426,7 +434,7 @@ OverlayScrollbars.plugin(ScrollbarsHidingPlugin);
|
|||||||
OverlayScrollbars.plugin([SizeObserverPlugin, ClickScrollPlugin]);
|
OverlayScrollbars.plugin([SizeObserverPlugin, ClickScrollPlugin]);
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Writing Plugins
|
### Writing Plugins
|
||||||
|
|
||||||
> __Note__: For now please refer to the <b>TypeScript definitions</b> for a more detailed description.
|
> __Note__: For now please refer to the <b>TypeScript definitions</b> for a more detailed description.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user