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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@inotom/sws-gotop

v2.7.0

Published

A web components to display the button to scroll to the top of the page.

Downloads

785

Readme

sws-gotop

A web components to display the button to scroll to the top of the page.

Demo

Demo

Usage

Place sws-gotop custom element.

<sws-gotop></sws-gotop>
<script type="module" src="sws-gotop.min.js" defer></script>

Set element's style etc... by css custom properties.

sws-gotop {
  --sws-gotop-position: fixed;
  --sws-gotop-size: 80px;
  --sws-gotop-aspect-ratio: 1;
  --sws-gotop-top: initial;
  --sws-gotop-left: initial;
  --sws-gotop-right: 50px;
  --sws-gotop-bottom: 100px;
  --sws-gotop-z-index: 1000;
  --sws-gotop-transition: opacity 0.3s, transform 0.3s;
  --sws-gotop-transform: translate3d(0, 50px, 0);
  --sws-gotop-fg-color: #fff;
  --sws-gotop-bg-color: #933;
  --sws-gotop-hover-opacity: 1;
  --sws-gotop-border-radius: 50%;
  --sws-gotop-border: 0 none;
  --sws-gotop-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);
  --sws-gotop-ripple-color: rgba(255, 255, 255, 0.5);
  --sws-gotop-ripple-border-radius: 50%;
  --sws-gotop-arrow-color: #fff;
  --sws-gotop-arrow-weight: 2px;
  --sws-gotop-arrow-scale: 1;
  --sws-gotop-pointer-focus-outline-width: 0;
  --sws-gotop-svg-max-width: 100%;
  --sws-gotop-image-object-fit: cover;
}

CSS custom properties

| css custom property name | content | defaults | |:------------------------------------------|:-------------------------------------------|:---------------------------------| | --sws-gotop-position | Position | fixed | | --sws-gotop-size | Horizontal size (width) | 80px | | --sws-gotop-aspect-ratio | Aspect ratio size | 1 | | --sws-gotop-top | Position from the top edge of the window | initial | | --sws-gotop-left | Position from the left edge of the window | initial | | --sws-gotop-right | Position from the right edge of the window | 50px | | --sws-gotop-bottom | Position from the bottom of window | 100px | | --sws-gotop-z-index | Value of z-index | 1000 | | --sws-gotop-transition | Show in transition | opacity 0.3s, transform 0.3s | | --sws-gotop-transform | Move button position before show in | translate3d(0, 50px, 0) | | --sws-gotop-fg-color | Foreground color | #fff | | --sws-gotop-bg-color | Background color | #933 | | --sws-gotop-hover-opacity | Transparency with mouse over | 1 | | --sws-gotop-border-radius | Border radius size | 50% | | --sws-gotop-border | Border style | 0 none | | --sws-gotop-shadow | Button shadow style | 2px 2px 5px rgba(0, 0, 0, 0.2) | | --sws-gotop-ripple-color | Ripple effect color | rgba(255, 255, 255, 0.5) | | --sws-gotop-ripple-border-radius | Ripple border radius size | 50% | | --sws-gotop-arrow-color | Arrow color | #fff | | --sws-gotop-arrow-weight | Thickness of the arrow | 2px | | --sws-gotop-arrow-scale | Scale size of the arrow | 1 | | --sws-gotop-pointer-focus-outline-width | Mouse pointer Fouced outline width | 0 | | --sws-gotop-svg-max-width | Arrow svg image max width | 100% | | --sws-gotop-image-object-fit | Image object fit property | cover |

Options

<sws-gotop
  boundary="200"
  src="button.png"
  media="(max-width: 768px)"
  label="Go to page top"
  index="0"
></sws-gotop>

| option name | content | defaults | |:------------|:----------------------------------|:---------------------| | boundary | Scroll position to start display | 200 | | src | Image path | '' | | media | Mobile device judgment width | (max-width: 768px) | | label | aria-label text | '' | | index | tabindex value | 0 | | mode | Select inner content, svg or slot | svg |

License

MIT

Author

inotom