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

overflow-scroller

v1.0.0

Published

A simple package that allows you to easily implement a horizontal scroll with previous and next arrows for desktop users.

Downloads

19

Readme

#Overflow Scroller

Overflow Scroller is a simple package of CSS and javascript that harnesses the simple overflow: auto behavior allowing for swipeability at mobile and on touch enabled devices (trackpads, magic mouse). On desktop devices it is enhanced to have previous and next arrows that control the scrolling. View the Demo here

Dependencies

There are a couple dependencies, it will work fine without them but it provides a better experience & performance if they are added.

  • Modernizr: Has browser feature detection for Hidden Scrollbars which is true for Mac OS and mobile OS. If 'hiddenscroll' is false (pc browser) the scrollbars will automatically be hidden.
  • Jquery Throttle Debounce: This adds the performace benefit of waiting until the scrolling is complete to show/hide the the previous/next arrows.

Getting Started

Overflow scroller only requires a simple set of items in a div to get started, the use the css the containing div should have a class name of overflow-scroller

The Markup

The HTML is pretty simple. A div with a collection of items that are ideally all the same height.

<div class="overflow-scroller">
  <div class="child-item">...</div>
  <div class="child-item">...</div>
  <div class="child-item">...</div>
  ....
</div>

The Script

Overflow scroller is written as a jQuery plugin, there are a few options you can pass to it as well.

  • scrollPercentage: A number from 0-1 which dictates how far each click on a previous or next arrow scrolls the container. Default: 1
  • scrollSpeed: A number in milliseconds indicating how fast the container scrolls. Default: 400
  • snapPoints: Boolean to add or remove css snap-points which are partially supported, See here for current support. CSS snap points properties can be customized in the CSS. Default: true
  $('.overflow-scroller').overflowScroller();

  //passing options
  $('.overflow-scroller').overflowScroller({
    scrollPercentage: .9,
    scrollSpeed: 400,
      snapPoints: false
  });

The Styles

Feel free to overwrite the styles to your liking. There is a provided .less file and .css file. We use the less file to build the css file.

Note: all child elements must have a width declared in CSS. The width can be a fixed pixel value or a % width of the container.

Before creating a pull request make sure to edit the .less file and then run:

lessc overflow-scroller.less overflow-scroller.css