All Projects → lakscastro → menu-hamburger

lakscastro / menu-hamburger

Licence: MIT license
🍔 A clean, simple and easy to use library to create a Menu Hamburger

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to menu-hamburger

Radialmenu
A highly customizable radial menu that's very easy to setup.
Stars: ✭ 371 (+2082.35%)
Mutual labels:  javascript-library, menu
Hamburgers
Tasty CSS-animated Hamburgers
Stars: ✭ 6,522 (+38264.71%)
Mutual labels:  menu, hamburger
impromptu.nvim
Create prompts fast and easy
Stars: ✭ 39 (+129.41%)
Mutual labels:  lib, menu
Menuspy
A JavaScript library to make navigation menus highlight the item based on currently in view section.
Stars: ✭ 283 (+1564.71%)
Mutual labels:  javascript-library, menu
vue-burger-button
🍔 vue-burger-button is a functional component, which is faster than a regular component, and is pretty small (JS min+gzip is lower than 700b and CSS min+gzip is lower than 400b).
Stars: ✭ 41 (+141.18%)
Mutual labels:  menu, hamburger
Accordion
Silky-smooth accordion widgets with no external dependencies.
Stars: ✭ 32 (+88.24%)
Mutual labels:  menu
liblex
C library for Lexical Analysis
Stars: ✭ 25 (+47.06%)
Mutual labels:  lib
fs-pochta-api
Библиотека для работы с API Почты России
Stars: ✭ 15 (-11.76%)
Mutual labels:  lib
imitate-wechat-menu-backend
用Vue.js模仿微信公众平台自定义菜单的前端页面
Stars: ✭ 98 (+476.47%)
Mutual labels:  menu
Menu
The most customizable menu for macOS apps.
Stars: ✭ 84 (+394.12%)
Mutual labels:  menu
example-typescript-package
Example TypeScript Package ready to be published on npm & Tutorial / Instruction / Workflow for 2021
Stars: ✭ 71 (+317.65%)
Mutual labels:  javascript-library
resizerjs
Simple resizing for flexbox
Stars: ✭ 16 (-5.88%)
Mutual labels:  javascript-library
react-circle-flags
🚀 A React component with a collection of 300+ minimal circular SVG country flags. Wrapper of HatScripts/circle-flags
Stars: ✭ 29 (+70.59%)
Mutual labels:  javascript-library
uPortal-web-components
A collection of uPortal Web Components and JavaScript utilities
Stars: ✭ 24 (+41.18%)
Mutual labels:  menu
teams-api
Unofficial Microsoft Teams Library
Stars: ✭ 92 (+441.18%)
Mutual labels:  lib
constant-time-js
Constant-time JavaScript functions
Stars: ✭ 43 (+152.94%)
Mutual labels:  javascript-library
Stardust
🎨Tiller Design System
Stars: ✭ 19 (+11.76%)
Mutual labels:  javascript-library
jigjs
🧩 A front-end framework
Stars: ✭ 22 (+29.41%)
Mutual labels:  lib
avy-menu
An Avy-powered popup menu
Stars: ✭ 16 (-5.88%)
Mutual labels:  menu
bsnav
An extended Bootstrap 4 menu with a bunch of utilities
Stars: ✭ 90 (+429.41%)
Mutual labels:  menu

Menu Hamburger

A clean, simple and easy to use library

Demo

Check a demo working here

PrintScreen

Opened Animating Animating Closed

Installation

Via packages

yarn add menu-hamburger 

or

npm i menu-hamburguer

Via CDN

<script type="text/javascript" src="https://unpkg.com/[email protected]/lib/menu-hamburger.min.js"></script>

Usage

HTML

<!DOCTYPE html>
<html>
<head>
  <title>A Simple Menu Hamburger</title>
  <script src="https://unpkg.com/[email protected]/lib/menu-hamburger.min.js"></script>
</head>
<body>
  <div id="menu-wrapper"></div>
  <script type="text/javascript">
  	//Js code here
  </script>
</body>
</html>

JavaScript - CDN

const rootElement = document.getElementById("menu-wrapper");
const menu = MenuHamburger.initialize({
  rootElement,
  size: 50,
  backgroundColor: "#f2f2f2",
});

JavaScript - Package

import MenuHamburger from "menu-hamburger";

const rootElement = document.getElementById("menu-wrapper");
const menu = MenuHamburger.initialize({
  rootElement,
  size: 50,
  backgroundColor: "#f1f1f1",
});

Config

Configure Menu Hamburger by passing an options object as the argument of the initialize method. Default values are:

const menu = MenuHamburger.initialize({
  rootElement: null,
  size: 30,
  lineWidth: 3,
  menuClassName: null,
  menuIconClassName: null,
  transition: 'all .2s ease-in-out',
  backgroundColor: 'white',
  borderRadius: '8px',
  iconColor: '#444',
  initOpened: false
});

rootElement

Receives the HTML container element from the menu

required: true
type: HTMLNode
Allowed values: any HTML Node
Default value: null

size

Receives the Menu Hamburger width and height

required: false
type: number
Allowed values: any number
Default value: 30

lineWidth

Receives the Menu line width

required: false
type: number
Allowed values: any number
Default value: 3

menuClassName

Receives the class to apply on the Menu Node

required: false
type: string
Allowed values: any valid HTML class string
Default value: null

menuIconClassName

Receives the class to apply on the Menu Node Icon

required: false
type: string
Allowed values: any valid HTML class string
Default value: null

transition

Receives the custom Css transition

required: false
type: string
Allowed values: any valid value to Css property transition
Default value: all .2s ease-in-out

backgroundColor

Receive the Background Color of Menu

required: false
type: string
Allowed values: any Css color
Default value: white

borderRadius

Receive the Menu border radius

required: false
type: string
Allowed values: any Css size
Default value: 8px

iconColor

Receive the Menu Icon color

required: false
type: string
Allowed values: any Css color
Default value: #444

initOpened

Defines whether the menu should start open or closed, where true means start open and false means start closed

required: false
type: boolean
Allowed values: true false
Default value: false

API

Menu exposes API methods that can be used to control the Menu externally. Example usage:

const menu = MenuHamburger.initialize({ ...yourConfigHere });

menu.toggle();
menu.open();
menu.close();

toggle

Opens the Menu if it is closed or closes if it is open

open

Open Menu

close

Close Menu

destroy

Destroys the current instance of the Menu

Add Event Listeners

Menu exposes custom events that can be hooked on to. Example usage:

const menu = MenuHamburger.initialize({ ...yourConfigHere });

menu.on("toggle", () => {
  console.log("Your imagination is the limit")
});

init

This function is called when the Menu is initialized

toggle

This function is called when the Menu is closed or opened

open

This function is called when the Menu is opened

close

This function is called when the Menu is closed

destroy

This function is called when the Menu is destroyed

Remove Event Listeners

The menu exposes custom events that can be used to remove an event listener. Example of use:

const menu = MenuHamburger.initialize({ ...yourConfigHere });

menu.on("toggle", () => {
  console.log("I'm adding a listener to the toggle event")
});
menu.off("toggle", () => {
  console.log("And right down here I already removed this event, so nothing will happen")
});

init

Remove the init event listener

toggle

Remove the toggle event listener

open

Remove the open event listener

close

Remove the close event listener

destroy

Remove the destroy event listener

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].