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 🙏

© 2026 – Pkg Stats / Ryan Hefner

cross-menu

v1.1.4

Published

仿亚马逊智能导航菜单功能,无依赖,支持现代浏览器

Downloads

62

Readme

cross-menu

GitHub stars GitHub forks GitHub issues JavaScript Style Guide npm version GitHub license

仿亚马逊智能导航菜单功能,无依赖,支持现代浏览器。

Example

Demo

Usage

npm install --save cross-menu

// ES6
import crossMenu from 'cross-menu'
crossMenu(options)

// or

<script src="node_modules/cross-menu/dist/cross-menu.js"></script>
<script>
  crossMenu(options)
</script>

Options

  • menu{HTMLElement} @require

    一级菜单元素

  • menuItemTag{String} @require

    一级菜单元素下的菜单项标签:[...menu.querySelectorAll(menuItemTag)]

  • submenu{HTMLElement} @require

    二级菜单元素

  • submenuItemTag{String} @require

    二级菜单元素下的菜单项标签:[...submenu.querySelectorAll(submenuItemTag)]

  • delay{Number} @default = 300

    菜单切换延迟时间,即鼠标移动过程中在三角形区域内停顿 delay 毫秒表示切换一级菜单。

  • position{Object} @value = { top: Number, left: Number }

    菜单距离浏览器最上边和最左边的距离

    一般情况下不需要设置此属性,菜单的偏移值会被计算出来。只有当页面加载完成后菜单处于隐藏状态 display: none 时你需要使用此属性帮助确定位置,因为隐藏元素的 offsetParentnull

  • activeClassName{String} @default = 'active'

    当前活动菜单类名

  • activeIndex{Number}

    活动菜单的索引值,可用来设置默认活动菜单。

  • keepSubmenuVisible{Boolean} @default = false

    是否保持二级菜单显示状态(不隐藏二级菜单)

example

crossMenu({
  menu: document.querySelector('.menu'),
  menuItemTag: 'li',
  submenu: document.querySelector('.submenu'),
  submenuItemTag: 'li',
  delay: 100,
  activeClassName: 'active-menu',
  activeIndex: 3,
  keepSubmenuVisible: true
})

LICENSE

MIT