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

np-scrollp

v2.0.2

Published

解决IOS上面各种body overScroll

Downloads

7

Readme

#移动设备web开发防滚插件

向上找到能滚的元素然后让它滚。支持xy轴各种滚。 主要是保留ios上overScroll的体验,同时避免出现body的overScroll导致fixed的元素不fixed

body中加一个全屏的wrapper代替body作为容器,wrapper的scroll按需设置成scroll|auto

##规则:

  1. overflow:scroll并能滚动的元素在scroll方向上始终保持能够滚动状态
  2. overflow:auto 的元素在scroll方向上如果能滚动则滚动,不能滚动则向上查找可滚动元素

##实现:

  1. touchstart:
  • 找到当前手指[0]的元素向上冒泡的第一个[规则1]元素,如果元素在滚动方向上贴到边缘,则往反方向挪动1px,使移动时能保持滚动
  1. touchmove:
  • 判断是否时排除的元素
  • 找到当前手指[0]的元素向上冒泡的符合下面条件的元素:
    • overflow:scroll/auto
    • scrollSize > clientSize
    • 滚动方向上没有贴到边缘
  • 上述两个条件都不符合则evt.prentDefault();

##config:

  1. isExtraElement [function] 排除节点判定,input[type="range"]等

##使用 require('np-scrollp') .config({ //config xxx }) //初始化绑定touch事件 .bind() //把fixed的节点移动到body里面, move([nodes, targetDOM]) .move();

    //解除事件绑定(虽然写了这个api之后从来没用过)
    .destory();