npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dile-smooth-scroll

v1.1.1

Published

Webcomponent dile-smooth-scroll smooth scroll component

Readme

Moved

This package has moved and is now available at @dile/dile-smooth-scroll. Please update your dependencies. This repository is no longer maintained.

<dile-smooth-scroll>

Web Component to create smooth scrolls on the page document or in a element scrolling section. Based on LitElement.

Also this package provides a mixin to implement scrollin API functions to any component you need.

Go to DEMOS page!

Installation

npm i dile-smooth-scroll

Usage

<script type="module">
  import 'dile-smooth-scroll/dile-smooth-scroll.js';
</script>

<dile-smooth-scroll id="scrollComponent"></dile-smooth-scroll>

This component is not representational, actually provides a simple scroll API. So, you can call it's methods to create smooth scrolls in various ways.

For example:

  // This method do a smooth scroll to the bottom of the document.
  document.getElementById('scrollComponent').smoothScrollToBottom();

  // This method do a smooth scroll to the top of the document.
  document.getElementById('scrollComponent').smoothScrollToTop();

Is important to note that the component uses the Javascript native scroll API. If you need to run this component in browsers that do not support it, you will need to use a polyfill. Please find the compatibility of the scroll API in Caniuse.

API methods

  • smoothScrollToTop(): Scrolls the entire document to the top.
  • smoothScrollToBottom(): Scrolls the entire document to the bottom.
  • smoothScroll(top, left): Scrolls the entire document to top & left position.
  • smoothScrollBy(top, left): Scrolls the entire document by top & left values.
  • smoothScrollElementIntoView(element): Scrolls the entire document to the position of the element passed by argument.
  • smoothElementScrollTop(element): Scrolls a section with it's own scrolling area to the top.
  • smoothElementScrollBottom(element): Scrolls a section with it's own scrolling area to the bottom.
  • smoothElementScroll(element, top, left): Scrolls a section with it's own scrolling area to the top & left position.
  • smoothElementScrollBy(element, top, left): Scrolls a section with it's own scrolling area by top & left values.

properties

  • scrollToElementOnInit: when the scrollToElementOnInit property is set with an element ID, during the initialization progress of the component the page will scroll to the position of the element ID configured.

Mixins

In this package you will find mixins to implement the scrolling API into any component. We separate the scrolling API into two mixins because usually you need only one or other.

DileSmoothScrollMixin

This Mixin includes all methods related to scroll the entire document area. These are:

  • smoothScrollToTop
  • smoothScrollToBottom
  • smoothScroll
  • smoothScrollBy
  • smoothScrollElementIntoView

To use the mixin in a Web Component you can use a code like this:

import { DileSmoothScrollMixin } from 'dile-smooth-scroll/DileSmoothScrollMixin';

class MyOwnComponent extends DileSmoothScrollMixin(LitElement) {
  // code of your own component
}

DileSmoothScrollElementMixin

This mixin implements the methods to scroll the content of a element with it's own scrolling section.

The methods included in it are:

  • smoothElementScrollTop
  • smoothElementScrollBottom
  • smoothElementScroll
  • smoothElementScrollBy