1.0.1 • Published 11 months ago
@yyuedaa/create-dropdown v1.0.1
@yuedaa/create-dropdown
A utility function to create and manage a customisable dropdown component with support for click and hover event types.
Installation
Install the package using npm:
npm install @yyuedaa/dropdownUsage
Import the Function
import createDropdown from '@yyuedaa/dropdown';Example HTML
<div class="dropdown">
<button class="dropdown-toggle">Menu</button>
<ul class="dropdown-menu">
<li>Option 1</li>
<li>Option 2</li>
<li>Option 3</li>
</ul>
</div>Initialise the dropdown
const dropdownElement = document.querySelector('.dropdown');
const dropdown = createDropdown(dropdownElement, { eventType: 'click' });