1.0.4 • Published 5 months ago
smooth-scroll-ak v1.0.4
Smooth Scroll AK
A customizable smooth scrolling library for ReactJS applications. This package provides fluid, momentum-based scrolling with adjustable settings for momentum, touch, and speed.
Installation
Install the package using npm:
npm install smooth-scroll-ak
Or using yarn:
yarn add smooth-scroll-ak
Usage
Wrap your content with the SmoothScroll
component to enable smooth scrolling:
import React from 'react';
import SmoothScroll from 'smooth-scroll-ak';
const App = () => {
return (
<SmoothScroll momentum={0.2} touchMomentum={0.1} speed={0.1}>
<div style={{ height: '200vh' }}>
<h1>Smooth Scrolling Example</h1>
<p>Scroll down to see the smooth scrolling effect.</p>
</div>
</SmoothScroll>
);
};
export default App;
Props
Prop | Type | Default | Description |
---|---|---|---|
momentum | number | 0.1 | Controls the momentum effect on mouse wheel scroll. |
touchMomentum | number | 0.05 | Controls the momentum effect on touch scroll. |
speed | number | 0.05 | Controls the speed of the smooth scrolling animation. |
Features
- Fluid, Momentum-based Scrolling: Smooth and natural scrolling experience.
- Customizable Settings: Adjust
momentum
,touchMomentum
, andspeed
to fit your needs. - Peer Dependency Support: Compatible with React 17 and 18.
- Browser Compatibility: Works with all modern browsers.
Peer Dependencies
This package requires the following peer dependencies:
react
(v17 or v18)react-dom
(v17 or v18)
Ensure these are installed in your project to avoid compatibility issues.
License
MIT
Author
Developed by Mohd Akram Uddin.
Contributing
Feel free to contribute or report issues on GitHub.