mouse-select
v1.2.2
Published
An elegant javascript class for mouse selection.
Downloads
22
Maintainers
Readme
mouse-select
An elegant javascript class for mouse selection.
Demo
Try it: Live demo
installation
npm install mouse-select
basic usage
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")
});
});