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

navbar-builder

v1.4.2

Published

导航和页面内容通过锚点联动的插件

Downloads

10

Readme

常见的锚点定位页面位置--页面位置滚动联动锚点的插件

使用

  1. 比如导航为:语文 数学:

    <div class="sidebar">
        <a href="#yuwen">语文</a>  
        <a href="#shuxue">数学</a> 
        <a href="#gotop">回到顶部</a>
    </div>
  2. 需要有对应ID的html元素,比如:

    <div id="gotop"></div>
    <div id="yuwen"></div>  
    <div id="shuxue"></div>
  3. js代码:

    var buildBar = require('navbar-builder'); 
    buildBar({
       "anchors": ['gotop', 'yuwen', 'shuxue'],
       "activeClass": 'active',
       "autoHide": true,
       "autoHideThreshold": 200,
       "useFade": false,
       "sideBar": $(".sidebar")
    });

options

|名称|是否必须|描述| |:--:|:--:|----| | anchors | 必须 | 锚点列表数组注意:锚点列表数组必须按位置从上到下的顺序排列 | | activeClass | 可选 | 当前锚点的class,默认为active | | autoHide | 可选 | 整个导航区域,是否是自动显示隐藏的。适合导航栏在右侧的情况,默认隐藏,往下滚动200px后显示 | | autoHideThreshold | 可选 | 往下滚动多少后进行显示 | | useFade | 可选 | 是否用fadeIn和fadeOut进行显示,默认false(用show()和hide()) | | sideBar | 可选 | 导航的容器元素。默认为$('.sidebar') |

依赖jquery

但项目中可能已经引入了jquery,所以不做硬性引入,以免版本不同造成的冲突。使用时请自行添加依赖

实现效果

1.点击锚点,页面可以滚动

2.页面滚动到某个位置时,其对应的导航将高亮(默认加上active的class)

示例界面

http://jsblog.cc/demo/ab/

有问题请联系:[email protected]