# @dilane3/smoothscroll-js

> A simple smooth scroll library for JavaScript.

Latest version **1.0.2** (published 2022-09-01) · ISC license · 0 weekly downloads

## Install

```sh
npm install @dilane3/smoothscroll-js
pnpm add @dilane3/smoothscroll-js
yarn add @dilane3/smoothscroll-js
bun add @dilane3/smoothscroll-js
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2022-09-01 |
| First published | 2022-09-01 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | dilane3 |
| Maintainers | dilane3 |
| Keywords | smoothscroll, scroll, scrollto, smooth, vertical |

## Links

- npm: https://www.npmjs.com/package/@dilane3/smoothscroll-js
- Repository: https://github.com/dilane3/smoothscroll-js
- Homepage: https://github.com/dilane3/smoothscroll-js.git#readme
- Issues: https://github.com/dilane3/smoothscroll-js.git/issues
- npm.io page: https://npm.io/package/@dilane3/smoothscroll-js

## Dependencies (1)

- [normalize-wheel](https://npm.io/package/normalize-wheel.md) ^1.0.1

## Recent versions

- 1.0.2 (latest) — 2022-09-01
- 1.0.1 — 2022-09-01
- 1.0.0 — 2022-09-01

## README

# Smoothscroll-js
  
A simple smooth scroll library for JavaScript. 

## Advantages

* Easy to use
* Lightweight
* Fast
* Cross-browser
* Customizable

## Installation

```bash
npm install @dilane3/smoothscroll-js
```

or 

```bash
yarn add @dilane3/smoothscroll-js
```

## Usage

Genarally, you can use the library like this.

```jsx
import SmoothScroll from '@dilane3/smoothscroll-js';
```

Then you can use it in your application:

```jsx
// Wrapper element for smooth scrolling
const wrapper = document.querySelector('.wrapper');

// Smooth scroll option
const options = {
  direction: 'v',
  smooth: 0.08
}

// Initialization
new SmoothScroll(wrapper, options);
```

**For React App**

Especialy for React App, you can use the library like this.

```jsx
import SmoothScroll from '@dilane3/smoothscroll-js';
```

Then you can use it in your application:

```jsx
// Create a component for smooth scrolling
const App = () => {
  const wrapper = useRef(null);

  useEffect(() => {
    const options = {
      direction: 'v',
      smooth: 0.08
    }

    new SmoothScroll(wrapper.current, options);
  } , []);

  return (
    <div ref={wrapper} className="wrapper">
      <div className="content">
        <h1>Hello World</h1>
        <p>This is a paragraph</p>
      </div>
    </div>
  );
}

```

## Parameters

The constructor of SmoothScroll accepts the following parameters.

| Parameter | Type        | Description |
| --------- | ----------- | ----------- |
| wrapper   | HTMLElement | The wrapper element for smooth scrolling |
| options   | Object      | The options for smooth scrolling |

### Options parameters

| Parameter | Type            | Description |
| --------- | --------------- | ----------- |
| direction | 'v' or 'v-'      | The direction of smooth scrolling |
| smooth    | Number          | The smooth value of smooth scrolling |

## License

ISC License

Copyright (c) 2022 Dilane3

---
_Source: https://npm.io/package/@dilane3/smoothscroll-js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
