Giter Site home page Giter Site logo

menu-aim's Introduction

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:

    Key Description Default
    menuItemSelector Selector for each menu item. .menu-aim__item
    menuItemActiveClassName Class name assigned to a menu item when it is active. menu-aim__item--active
    menuItemSubMenuSelector Selector for the sub-menu element nested within each menu item. .menu-aim__item-submenu
    delayingClassName Class 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

menu-aim's People

Contributors

yuanqing avatar svkarpovich avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.