1.0.1 • Published 6 months ago

dropdwn v1.0.1

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

dropdwn-npm-package

How It works?

  1. install package in your project directory
npm install dropdwn
  1. import package in your project's js file
import {toggleDropdownVisibility} from 'dropdwn';
//or the entire path in case you are importing to browser
  1. 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>
  1. use toggleDropdownVisibility
const dropdownDiv = document.querySelector(".dropdown");
const options = document.querySelector(".options");

toggleDropdownVisibility(dropdownDiv, options);

And finally style as per your needs.

1.0.1

6 months ago

1.0.0

6 months ago