1.0.4 • Published 6 months ago

@anthonyr1616/dropdown-component v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

@anthonyr1616/dropdown-component

Simple dropdown for my own use

Usage

Use html code with structure like below with class 'dropdown' being the outer div that contains a div of class 'div-trigger' and class 'dropdown-options' for the menu. Inside 'dropdown-options' div should be the options that will be in the dropdown and have the 'dropdown-option' class.

<div id="my-dropdown" class="dropdown">
  <div class="dropdown-trigger">Select</div>
  <div class="dropdown-options">
    <div class="dropdown-option">First</div>
    <div class="dropdown-option">Second</div>
    <div class="dropdown-option">Third</div>
  </div>
</div>

In javascript create Dropdown object using the Dropdown class with the dropdown htmlelement as the first argument. Second argument is a optional and is used to make dropdown use hover event or click.

const myDropdown = document.querySelector('#my-dropdown');
const dropdown = new Dropdown(myDropdown, {event: "hover"});
1.0.4

6 months ago

1.0.3

6 months ago

1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago