Selection Area
Simple JavaScript mouse & touch seletion area to any DOM container element.
How to use | API Reference | Demo
How to use
Download
npm
Install with npm install selection-area
yarn
Install with yarn add selection-area
From Source Code
Clone or download zipped source code into node_modules
project folder.
git clone https://github.com/lucasmenendez/selection-area.git <project>/node_modules/selection-area
Import
Local dist version
Import using script
html tags with vendor path:
Or import using ES6 import
:
;
CDN version
Importing with unpkg.com:
Example
Define container for selection area and selectable childs.
0 1 2 3 4 5 6 7 8 9
Define SelectionArea
behaviour with configuration
object, check available parameters here.
let config = container: document area: class: 'custom-area' targets: '.child' touchable: true autostart: true { if selectionlength == 0 ; else ; } let selectable = config;
Also you can stylize the selection area element adding style yo defined class.