toggle-dropdown-odai
v1.0.1
Published
Reusable dropdown toggling function (hover and click) for web UIs.
Downloads
8
Maintainers
Readme
toggle-dropdown-odai
A reusable dropdown toggling function for web UIs that works with hover and click. Perfect for modern menus and navigation components.
Features
- Show/hide dropdown menus on click or hover.
- Fully reusable for multiple dropdowns on the same page.
- Lightweight and easy to integrate.
- Written in ES Modules (
import/export).
Installation
npm install toggle-dropdown
Usage
<!-- HTML -->
<button id="dropdownBtn">Menu</button>
<div class="menu-items">
<a href="#">Item 1</a>
<a href="#">Item 2</a>
<a href="#">Item 3</a>
</div>
// JavaScript
import { toggleDropdown } from "toggle-dropdown";
document.addEventListener("DOMContentLoaded", () => {
const btn = document.querySelector("#dropdownBtn");
const menu = document.querySelector(".menu-items");
toggleDropdown(btn, menu);
});