Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/agence-webup/dropmic
A lightweight dropdown plugin
https://github.com/agence-webup/dropmic
dropdown es6 js lightweight vanilla
Last synced: about 1 month ago
JSON representation
A lightweight dropdown plugin
- Host: GitHub
- URL: https://github.com/agence-webup/dropmic
- Owner: agence-webup
- License: mit
- Created: 2016-08-31T15:59:33.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-03-04T02:55:28.000Z (almost 2 years ago)
- Last Synced: 2024-11-11T18:48:24.601Z (about 2 months ago)
- Topics: dropdown, es6, js, lightweight, vanilla
- Language: JavaScript
- Homepage:
- Size: 681 KB
- Stars: 34
- Watchers: 8
- Forks: 4
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![Logo dropmic](logo.svg)
## Introduction
**dropmic** is a lightweight dropdown plugin written in pure javascript
- No dependencies required
- No extra files to download
- Fully customizable via CSS
- Simple API## Documentation
### Installation
Method | Procedure
-------------------------- | ---------
Bower | bower install dropmic --save
NPM | npm install dropmic
Yarn (obsolete since npm5) | yarn add dropmic
Download | [Download zip](https://github.com/agence-webup/dropmic/archive/master.zip)Then dropmic have some css you will have to add (feel free to custom it for a better integration in your UI):
```html
```
Finally just link the dropmic's code at the end of your document:
```html
```
Or as a JS module:
```js
// ES6 module build
import dropmic from 'dropmic'
```### Use
#### Create the base layout for your button
1. Add `data-dropmic-btn` attribute to your button
2. Create a div with a `dropmic` css class
3. Add a `data-dropmic-direction` attribute to the div (default behavior: `bottom-right`):- `data-dropmic-direction="top-left"`
- `data-dropmic-direction="top-right"`
- `data-dropmic-direction="top-middle"`
- `data-dropmic-direction="bottom-left"`
- `data-dropmic-direction="bottom-right"`
- `data-dropmic-direction="bottom-middle"`4. You can also add a `data-dropmic` attribute to you div for target it.
Example:
```html
click me
```#### Instantiate your new dropdown
```javascript
var dropmic = new Dropmic(document.querySelector('[data-dropmic="42"]'));
```#### Add content
You can create the content by yourself or use the API (cf. below)Use this template (`