1.0.0 • Published 2 years ago
make-this v1.0.0
<make-this/dropdown>
created as part of The Odin Project coding curriculum
Simple module to add dropdown functionality to your menu:
- show menu on button click
- hide menu on next subsequent click (anywhere on page)
Instructions
Build the HTML elements, as below (make sure you add the classes):
<div> <button id="button"> //button to open menu <div id="menu" class="hidden"> //div containing dropdown buttons <button class="vertical"> . . . //as many buttons as needed </div> </div>
Add the hidden & vertical classes in CSS:
.vertical { display: block; } .hidden { display: none; }
Install:
$ npm install make-this --save-dev
Import the function into your .js file:
import { makeItDropdown } from "make-this/src/dropdown"
Use your button and menu ids to make it drop:
makeItDropdown(button, menu);
Questions or feedback?
contact: miss.liner@yahoo.com
1.0.0
2 years ago