# dropdown
**Repository Path**: mirrors_TrySound/dropdown
## Basic Information
- **Project Name**: dropdown
- **Description**: Just control all custom dropdowns on your page
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-09-26
- **Last Updated**: 2025-09-14
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# Dropdown
Just control all custom dropdowns on your page
## Dependencies
dropdown dependent of [classList shim](https://github.com/jwilsson/domtokenlist) and new [closest shim](https://github.com/jonathantneal/closest)
## Usage
```js
dropdown.init()
```
```html
Link 1
-
Link 1
- Content 1
- Content 2
- Content 3
-
Link 2
- Content 1
- Content 2
- Content 3
```
```css
.dropdown {
position: relative;
}
.dropdown-link {
cursor: pointer;
}
.dropdown-list {
visibility: hidden;
position: absolute;
left: 0;
top: 100%;
}
.dropdown-active {
z-index: 100;
visibility: visible;
}
```
## API
### dropdown.init(opts)
Initialize click listener on links
#### Options
**link** - selector of clickable trigger
Default: `'.dropdown-link'`
**list** - selector of content that will be matched with next sibling or function(link) return list;
Default: `undefined`
**classLinkActive**
Default: `'dropdown-active'`
**classListActive**
Default: `classLinkActive value`
### dropdown.close()
Close last opened dropdown and return true if it existed
### dropdown.on(name, callback)
**name:** `'open'` or `'close'`
**callback:** `function (link, list, opts)`
Could be useful for plugins
##License
[The MIT License (MIT)](LICENSE.md)
Copyright © 2015 Bogdan Chadkin