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

@xpf0000/js-scrollbar

v1.0.8

Published

javascript scrollbar

Downloads

4

Readme

js 滚动条组件

特性

  1. 原生代码, 无引用

  2. 自定义滚动条样式

  3. 尽量减少对页面的侵入度, 只增加两个横竖div滚动条

  4. 自动监听尺寸和内容变化, 自动响应

安装

npm install @xpf0000/js-scrollbar

使用

import { XScrollBar } from "@xpf0000/js-scrollbar";
XScrollBar(document.documentElement, {
xy: 'xy', // x | y | xy
offsetX: 30, // 横向滚动条左右间距 数字 | 带单位的字符串 ('10%' | '5rem')
offsetY: 50,  // 纵向滚动条上下间距 数字 | 带单位的字符串 ('10%' | '5rem')
className: '', // 自定义类名 方便对单个滚动条更改样式
autoHide: true, // 是否在鼠标静止后 自动隐藏滚动条
autoHideDelay: 5000, // 鼠标静止后 多久隐藏滚动条
})
import ScrollBar from './index'
Vue.use(ScrollBar)

<div v-scrollbar="{ xy: 'xy', offsetY: 100, offsetX: 50 }">
</div>

样式

参照scrollbar.css修改全局样式 或者使用className修改单个滚动条的样式

.x-scroll-bar-x {
  position: absolute;
  left: 0;
  bottom: 20px;
  height: 10px;
  width: 100%;
  border-radius: 5px;
  overflow: hidden;
  background: rgba(50, 50, 50, 0.2);
}

.x-scroll-bar-x .bar-plant {
  position: absolute;
  left: 0;
  top: 20%;
  height: 60%;
  width: 150px;
  border-radius: 5px;
  overflow: hidden;
  background: rgba(10, 10, 10, 0.5);
}

.x-scroll-bar-y {
  position: absolute;
  right: 20px;
  top: 0;
  height: 100%;
  width: 10px;
  border-radius: 5px;
  overflow: hidden;
  background: rgba(150, 150, 150, 0.3);
}

.x-scroll-bar-y .bar-plant {
  border-radius: 5px;
  overflow: hidden;
  position: absolute;
  left: 20%;
  top: 0;
  width: 60%;
  height: 150px;
  background: rgba(10, 10, 10, 0.5);
}

.x-scroll-bar-x:hover, .x-scroll-bar-y:hover {
  opacity: 1.0;
}

.x-scroll-bar-x.x-scroll-dragging, .x-scroll-bar-y.x-scroll-dragging {
  opacity: 1;
}

.x-scroll-bar-x.x-scroll-hide, .x-scroll-bar-y.x-scroll-hide {
  opacity: 0;
}

.x-scroll-bar-x, .x-scroll-bar-y {
  opacity: 1.0;
  transition: opacity 0.5s;
  z-index: 2000;
}