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

elevator-nav

v1.0.4

Published

Component of Elevator navigation

Downloads

112

Readme

电梯导航组件

demo效果预览:https://zhouxingzu.github.io/elevator-nav/

使用方法

一、安装

npm install elevator-nav

二、引入使用:

// html

<div class="floor1">Floor1</div>
<div class="floor2">Floor2</div>
<div class="floor3">Floor3</div>
<div class="footer">Footer</div>

<div class="left-nav">
    <ul class="nav-ul">
        <li class="nav-item">Floor1</li>
        <li class="nav-item">Floor2</li>
        <li class="nav-item">Floor3</li>
        <li class="toTop">回到顶部</li>
    </ul>
</div>
// js
import ElevatorNav from 'elevator-nav';

var nav = new ElevatorNav({
    floorClass: ['floor1','floor2','floor3'],  //对应楼层的class名
    navClass: "nav-item",   //电梯菜单的class名
    activeClass: "active",  //当前楼层高亮状态的class名
    toTopClass: "toTop",    //回到顶部的class名
})

注:由于项目依赖jquery,所以请在渲染出DOM元素后再进行初始化

三、详细API文档说明

参数 | 描述 | 类型 | 默认值 ----|---|---|--- floorClass | 对应DIV楼层的class名 | string[] | [] navClass | 导航菜单的class名 | string | activeClass | 当前楼层需要高亮显示的class名 | string | 'active' toTopClass | 回到顶部按钮的class名 | string | scrollContent | 滑动容器的class名 | string | window isRemoveAnimation | 是否移除类名随点击跟着跑的效果,注意如果使用此参数,滚动事件将会失效 | boolean | false autoHidden | 默认是否隐藏菜单,滑到第一层才出现 | boolean | false navDivClass | 如果设置了autoHidden:true, 则需要设置导航菜单的class名 | string | offset | 滑动定位时需要偏移的数值 | number | 0 speed | 滚动速度 | number | 500 diyFun | 绑定自定义方法 | Function |

例如:

var nav = new ElevatorNav({
    floorClass: ['floor1','floor2','floor3','floor4'],  //楼层的class名
    navClass: "nav-item",  //电梯菜单的class名
    activeClass: "active",  //状态高亮的class名
    toTopClass: "toTop",    //回到顶部的class名
    scrollContent: 'content',  //滑动容器的class名
    isRemoveAnimation: true,    //是否移除类名随点击跟着跑的效果,默认为false
    autoHidden: true,   //是否隐藏菜单,滑到第一层才出现,默认为false
    navDivClass: "left-nav",    //需要默认隐藏菜单的class名
    speed: 500,     //滚动速度,默认为500
    diyFun: function(){
        console.log('自定义方法');
    }
})