Gathering detailed insights and metrics for smooth-smooth-scroll
Gathering detailed insights and metrics for smooth-smooth-scroll
Gathering detailed insights and metrics for smooth-smooth-scroll
Gathering detailed insights and metrics for smooth-smooth-scroll
vuepress-plugin-smooth-scroll
VuePress plugin for smooth scrolling
scroll-into-view-if-needed
Ponyfill for upcoming Element.scrollIntoView() APIs like scrollMode: if-needed, behavior: smooth and block: center
smooth-scroll-into-view-if-needed
Ponyfill for smooth scrolling elements into view (if needed!)
smoothscroll-polyfill
Smooth Scroll behavior polyfill
My realization of smooth scrolling to an element on click
npm install smooth-smooth-scroll
Typescript
Module System
Node Version
NPM Version
Fix destination element's style attribute override
Updated on Aug 23, 2021
Logical fixes
Updated on Feb 24, 2020
Fixing the disable function implementation
Updated on Jan 26, 2020
Release
Updated on Jan 25, 2020
The version where I said that it will not be an npm package
Updated on Jan 25, 2020
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
1 Stars
44 Commits
2 Watchers
9 Branches
1 Contributors
Updated on Feb 23, 2025
Latest Version
1.7.1
Package Id
smooth-smooth-scroll@1.7.1
Unpacked Size
16.57 kB
Size
6.69 kB
File Count
6
NPM Version
6.14.8
Node Version
12.18.3
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Solves the same problem as https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-padding.
That's a simple to use realization of a smooth scroll for your website. It's especially useful if you have some fixed elements and want to correct the scroll destination.
Very lightweight - only 1.94 KB
Works in all alive browsers (requires 4.1 KB of polyfills)
You can change parameters of scroll after the first activation with a bit of js and easily add new links
It's built with scrollIntoView
what gives a lot of advantages other smooth-scroll packages don't have:
And the last but one of the most essential features of the package is the ability to set an offset for scroll. It may be useful just for small adjustments, but the most obvious use case is to prevent content overlap with a fixed header
npm i smooth-smooth-scroll
1// Don't forget polyfill first if you need it (Required by Safari and IE) 2import 'smooth-smooth-scroll/polyfill'; 3import { initSmoothScroll } from 'smooth-smooth-scroll';
Note: Polyfill file contains two things: smoothscroll-polyfill and closest polyfill.
So, it means you can use them further in the project without any old browser support worries.
1const disableSmoothScroll = initSmoothScroll(smoothScrollOptions);
The initSmoothScroll
returns a function which removes the eventListener used by smooth-smooth-scroll.
You just need to add a data attribute to any element. You can do it initially by hand in your Html file or later with javascript.
1<div class="some-element" data-smooth-scroll-to="element-id"></div> 2<div class="another-element" id="element-id"></div>
1const someElement = document.querySelector('.some-element');
2
3someElement.setAttribute('data-smooth-scroll-to', 'element-id');
4// or
5someElement.dataset.smoothScrollTo = 'element-id';
I recommend to use <button>
tags for link elements.
By default they are like this:
1{ 2 offsetTop: 0, 3 offsetBottom: 0, 4 offsetLeft: 0, 5 offsetRight: 0, 6 block: 'start', 7 inline: 'nearest', 8 eventListenerOptions: {}, 9}
You'll probably need only the offsetTop
property. Just set your fixed header height and thats all. All the other offsets may be needed if you have some other elements from other directions.
Talking about block
and inline
, they represent literally the same thing as in scrollIntoView do. But don't afraid if you use only block: 'start'
for all links on the page and suddenly realize you need block: 'center'
for one element - there is a solution for this at the next step.
The eventListenerOptions
object goes to the smooth-smooth-scroll eventListener options. There is only one, it is setten on document
so you can not to afraid of performance issues if you have thousands of links.
You can set them via data-attributes, such as:
1data-smooth-scroll-block="center" 2<!-- and --> 3data-smooth-scroll-inline="end"
Look at the third step for more code examples.
At first, I didn't want to create an npm package for this, but the name smooth-smooth-scroll
I come up with sounded so cool so I decided to do it. I hope you find it useful!
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/14 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
27 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More