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 🙏

© 2025 – Pkg Stats / Ryan Hefner

dragscroll-ts

v1.0.4

Published

Drag Scroll library - smooth content scroll via mouse/touch dragging

Readme

🎉 DragScroll library

Drag Scroll library - smooth content scroll via mouse/touch dragging. Publish standard format Js such as commonJs, ES Modules, UMD, Typescript

Alt text

Why DragScroll ?

  • More comfortable with physical UI, make consistency between different devices

Usage

First of all, you need to import this library:

// Javascript tag
<script type="type/javascript" src="https://unpkg.com/[email protected]/build/dragscroll.min.js"></script>
// Common Javascript
const DragScroll = require('dragscroll-ts')
// ES6 Module Javascript
import DragScroll from 'dragscroll-ts'
// Typescript
import DragScroll, { IDragScrollOptions } from 'dragscroll-ts'

const options: IDragScrollOptions = {}

interface IDragScrollOptions {
    $container: HTMLElement
    $content: HTMLElement
    axis: string
    allowInputFocus?: boolean
    allowSelectText?: boolean
}

Next step, init drag scroll instance

- NOTE: This library only wrap dragscroll logic on available HTML, It doesn't touch to stylesheet 😉
- Need to be specified the HTML structure of $container, $content elements. See picture below
const $container = document.getElementById('demo-wrapper')
const $content = document.getElementById('demo-content')

new DragScroll({
    $container: $container,
    $content: $content,
    axix: 'x',
    allowInputFocus: true,
    allowSelectText: false,
})

Alt text

Config options

| Option | Type | Description | | --------------- | ----------- | ------------------------------------------------- | | $container | HTMLElement | The element wrap the dragable element | | $content | HTMLElement | The dragable child element of $container. | | axis | string | Default is 'x'. There are 3 values: 'x', 'y','xy' | | | | 'x' is horizontal direction | | | | 'y' is vertical direction | | | | 'xy' is both direction | | allowInputFocus | boolean | Allow input fields can be focused | | allowSelectText | boolean | Allow text content can be selected |

API

| Name | Description | | -------------------- | ------------------------------------------------------------ | | scrollTo | Pass coordinate object { x, y } to scroll to target position | | setInputCanBeFocused | Default is true. Input fields can be focused | | setTextCanBeSelected | Default is true. Text content can be selected | | destroy | Remove all listeners |

Events

The evt parameter is either MouseEvent or TouchEvent

| Name | Description | | --------- | -------------------------------- | | dragstart | To be fired when starting drag | | dragging | To be fired when dragging | | dragend | To be fired when dragging content meet end point |

// Example:
const dragSroll = new DragScroll({})
function handler(evt) {}

dragSroll.on('dragstart', handler)
dragSroll.off('dragstart', handler)

Files size

| File | Format | size | | ----------------- | --------- | -------- | | dragscroll.min.js | UMD | 7.6 KB | | dragscroll.cjs.js | Common Js | 6.96 KB | | dragscroll.es.js | ES Module | 6.95 KB |

License

MIT License (c) 2020 XuanVinh