dropdwn
v1.0.1
Published
toggle the visibility of dropdown options
Downloads
1
Readme
dropdwn-npm-package
How It works?
- install package in your project directory
npm install dropdwn
- import package in your project's js file
import {toggleDropdownVisibility} from 'dropdwn';
//or the entire path in case you are importing to browser
- create dropdown in html and add a class "visible" in css
inside head
<style>
.options{
display: none;
}
.visible{
display: block;
}
</style>
inside body
<div class="dropdown">
<button id="dropdown-bttn">
<span>Button Name</span>
</button>
<div class="options">
<a href="">option1</a>
<a href="">option2</a>
<a href="">option3</a>
<!-- and other options -->
</div>
</div>
- use toggleDropdownVisibility
const dropdownDiv = document.querySelector(".dropdown");
const options = document.querySelector(".options");
toggleDropdownVisibility(dropdownDiv, options);
And finally style as per your needs.