Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/n1crack/mouse-select
Simple javascript class for mouse selection.
https://github.com/n1crack/mouse-select
es2015 mouse-events mouse-selection selection
Last synced: 2 days ago
JSON representation
Simple javascript class for mouse selection.
- Host: GitHub
- URL: https://github.com/n1crack/mouse-select
- Owner: n1crack
- License: mit
- Created: 2018-03-17T20:23:45.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-08-09T19:38:54.000Z (about 6 years ago)
- Last Synced: 2024-09-19T07:20:00.158Z (14 days ago)
- Topics: es2015, mouse-events, mouse-selection, selection
- Language: JavaScript
- Homepage:
- Size: 18.6 KB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mouse-select
An elegant javascript class for mouse selection.## Demo
Try it: [Live demo](https://codepen.io/anon/pen/vrWXxX)## installation
````
npm install mouse-select
````## basic usage
````javascript
import mselect from 'mouse-select';window.select = new mselect({
el: 'ul'
});select.onSelect(function (item, index) {
// add active class to selected items.
item.classList.add('active');}).onClear(function () {
// when starting new selection, remove existing selection
document.querySelectorAll('li.active')
.forEach(function (el) {
el.classList.remove("active")
});
});````