1.1.0 • Published 3 years ago

@default-js/defaultjs-html-dropdown v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

defaultjs-html-dropdown

How to Install via NPM

npm install @default-js/defaultjs-html-dropdown@latest
//main.js
import "@default-js/defaultjs-html-dropdown";
import "@default-js/defaultjs-html-dropdown/src/css/";

How to Install via Script Tag

Include all files and folder of dist/* into your project and include browser-defaultjs-html-dropdown.min.js and dropdown.css into your html page. If you are using the DropdownElement at javascript code, be sure that the include is before your code executed.

<html>
    <head>
        <link href="css/dropdown.css" rel="stylesheet">
        <script src="browser-defaultjs-html-dropdown.min.js" defer></script>
    </head>
</html>

Usage

<d-dropdown>
    <!-- your dropdown item title -->
    Menu 
    <d-dropdown-content>
        <!-- your dropdown content -->
        <div> menu entry</div>
        <div> menu entry</div>
        <div> menu entry</div>
    </d-dropdown-content>
</d-dropdown>

Javascript API

Class DropdownElement

AttributeDescription
modeclick or auto -> if value click, it forces the dropdown menu to open on click event
activeboolean -> true: open dropdown menu, false: close dropdown menu