Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

zenscroll

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zenscroll

A module to smooth-scroll web pages and DIVs

  • 3.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
319K
decreased by-1.19%
Maintainers
1
Weekly downloads
 
Created

What is zenscroll?

Zenscroll is a lightweight JavaScript library that provides smooth, customizable scrolling animations for web pages. It allows developers to easily scroll to specific elements or positions within a page with smooth animations.

What are zenscroll's main functionalities?

Smooth Scrolling to an Element

This feature allows you to smoothly scroll to a specific element on the page. In this example, clicking a button with the ID 'myButton' will smoothly scroll the page to an element with the ID 'myTarget'.

document.getElementById('myButton').addEventListener('click', function() {
  zenscroll.to(document.getElementById('myTarget'));
});

Smooth Scrolling to a Y Position

This feature allows you to smoothly scroll to a specific Y position on the page. In this example, clicking a button with the ID 'myButton' will smoothly scroll the page to the Y position 500.

document.getElementById('myButton').addEventListener('click', function() {
  zenscroll.toY(500);
});

Customizing Scroll Duration

This feature allows you to customize the duration of the scroll animation. In this example, the scroll duration is set to 1000 milliseconds (1 second). Clicking the button with the ID 'myButton' will smoothly scroll to the element with the ID 'myTarget' over 1 second.

zenscroll.setup(1000, 0);
document.getElementById('myButton').addEventListener('click', function() {
  zenscroll.to(document.getElementById('myTarget'));
});

Centering the Element

This feature allows you to smoothly scroll to an element and center it in the viewport. In this example, clicking a button with the ID 'myButton' will smoothly scroll the page to center the element with the ID 'myTarget'.

document.getElementById('myButton').addEventListener('click', function() {
  zenscroll.center(document.getElementById('myTarget'));
});

Other packages similar to zenscroll

Keywords

FAQs

Package last updated on 05 May 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc