Socket
Socket
Sign inDemoInstall

menu-aim

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    menu-aim

Instant mega menus in vanilla JavaScript.


Version published
Weekly downloads
2.3K
decreased by-33.84%
Maintainers
1
Install size
172 kB
Created
Weekly downloads
 

Readme

Source

menu-aim npm Version Build Status

Instant mega menus in vanilla JavaScript.

  • Keeps a sub-menu open when the mouse is determined to be enroute to it, else instantly switches to another item in the menu
  • 670 bytes gzipped

API

Editable demo (CodePen)

const menuAim = require('menu-aim')

menuAim(element [, options])

element is a DOM element and optionsis an optional object literal.

  • Returns a “clean up” function for removing event listeners bound by the function to element and window.

  • element has the following HTML structure:

    <ul class="menu-aim">
      <li class="menu-aim__item">
        <a class="menu-aim__item-name"><!-- ... --></a>
        <ul class="menu-aim__item-submenu"><!-- ... --></ul>
      </li>
      <!-- ... -->
    </ul>
    

    See the demo for the CSS styles required on element and the various nested elements.

  • Keys on options:

    KeyDescriptionDefault
    menuItemSelectorSelector for each menu item..menu-aim__item
    menuItemActiveClassNameClass name assigned to a menu item when it is active.menu-aim__item--active
    menuItemSubMenuSelectorSelector for the sub-menu element nested within each menu item..menu-aim__item-submenu
    delayingClassNameClass name applied to element when some menu item is active and the mouse is determined to be enroute to the active submenu.menu-aim--delaying

Installation

Install via yarn:

$ yarn add menu-aim

Or npm:

$ npm install --save menu-aim

Prior art

License

MIT

Keywords

FAQs

Last updated on 20 May 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc