jelliy
v0.1.11
Published
A lightweight, high-performance smooth scroll library. Modern, tree-shakeable, and smoother than the rest.
Maintainers
Readme
Jelliy
A lightweight, high-performance smooth scroll library. Modern, tree-shakeable, and smoother than the rest.
Features
- ⚡ Lightweight & Fast: Minified and gzipped with zero heavy dependencies.
- 🌐 Framework Agnostic: Works with plain JavaScript, React, Vue, Next.js, and Svelte.
- 🛡️ SSR Safe: Safely degrades in non-browser environments such as Node.js and Next.js SSR.
- 📘 TypeScript Ready: Includes hand-written TypeScript type definitions out of the box.
Installation
npm install jelliyOr via Yarn or pnpm:
yarn add jelliy
# or
pnpm add jelliyQuickstart
import Jelliy from 'jelliy';
// Initialize with default settings
const jelliy = new Jelliy();Configuration Options
Pass custom configuration options into the constructor:
const jelliy = new Jelliy({
lerp: 0.1, // Inertia / interpolation factor (0.01 to 1)
duration: 1.2, // Scroll duration target
smoothWheel: true, // Enable smooth scrolling for mouse wheels
smoothTouch: false, // Enable smooth scrolling on touch devices
});API Methods
scrollTo(target, options)
Programmatically scroll to a target element, CSS selector, or Y-coordinate.
// Scroll to a CSS selector
jelliy.scrollTo('#section-2');
// Scroll to a specific Y-offset in pixels
jelliy.scrollTo(1200);
// Scroll to a DOM element
const element = document.querySelector('.target');
jelliy.scrollTo(element);stop()
Freezes the scroll engine. Useful during modal popups or full-screen overlays.
jelliy.stop();start()
Resumes scrolling after the engine has been stopped.
jelliy.start();destroy()
Cleans up event listeners and cancels active animation frames.
jelliy.destroy();CDN Usage
You can also use Jelliy directly in HTML via UNPKG or jsDelivr:
<script src="https://unpkg.com/jelliy/dist/jelliy.min.js"></script>
<script>
const jelliy = new Jelliy();
</script>Browser Support
Jelliy is designed for modern browsers that support:
requestAnimationFrame- Modern DOM APIs
- ES6+ JavaScript
Author
MD. Khaliduzzaman Tanoy
GitHub: @khaliduzzamantanoy
License
MIT License
See the LICENSE file for details.
