@rndi/makedropdown

1.3.1 • Public • Published

makeDropDown

A personal node package that turns a specific HTML element structure into an animated drop down menu.

How to use

  1. Make sure to import the makeDropDown function from the makedropdown package using import().
  2. In your Javascript file, query the html document for the drop down menu element.
    1. Your drop down menu element must have this structure:
    <div class="dropdown">
        <button class="dropbtn">Drop Button Title</button>
        <div class="dropdown-content">
            <ul>
                <li></li>
                <li></li>
                ...
            </ul>
        </div>
    </div>
  3. Call makeDropDown() passing the queried drop down element in as its parameter. For example, assuming you've stored the drop down element in a variable called "dropDownElement", you would call the function like this:
import { makeDropDown } from 'makedropdown';
const dropDownElement = document.querySelector('div.dropdown');
makeDropDown(dropDownElement);

Readme

Keywords

Package Sidebar

Install

npm i @rndi/makedropdown

Weekly Downloads

1

Version

1.3.1

License

ISC

Unpacked Size

2.78 kB

Total Files

3

Last publish

Collaborators

  • rndi