Selection.js 介绍
一个简单轻量级的库,用于实现可视DOM选择,例如在桌面上。没有jQuery。支持任何css库,例如Bootstrap。包括垂直和水平滚动支持。
特征
支持触摸设备
用法简单
没有jQuery
垂直和水平滚动支持
安装
通过npmnpm install @simonwep/selection-js --save用法
const options = {// All elements with the class 'selectable' selectable.selectables: ['.selectable']};const selection = Selection.create(options);选项
const selection = new Selection({// Class for the selection-area-elementclass: 'selection-area',// px,how many pixels the point should move before starting the selectionstartThreshold: 10,// Disable the selection functionality for touch devicesdisableTouch: false,// On which point an element should be selected.// Available modes are cover (cover the entire element),center (touch the center) or// the default mode is touch (just touching it).mode: 'touch',// Enable single-click selection (Also disables range-selection via shift + ctrl)singleClick: true,// Query selectors from elements which can be selectedselectables: [],// Query selectors for elements from where a selection can be startstartareas: ['html'],// Query selectors for elements which will be used as boundaries for the selectionboundaries: ['html'],// Query selector or dom node to set up container for selection-area-elementselectionAreaContainer: 'body',// On scrollable areas the number on px per frame is devided by this amount.// Default is 10 to provide a enjoyable scroll experience.scrollSpeeddivider: 10,// Will be called before the selection starts (mouse / touchdown). Can be used// to specify which action / mousebutton are needed to start the selection.validateStart(evt) {evt; // MouseEvent or TouchEvent// Return true to start the selection,false to cancel it.return true;},// Element selection stardet,see Events for detailsonStart(evt) {evt.selection;evt.eventName;evt.areaElement;evt.originalEvent;evt.selectedElements;evt.changedElements;},// Single-click selectiononSelect(evt) {// Same properties as onStartevt.target; // Clicked element},// Element selection moveonMove(evt) {// Same properties as onStart},// Element selection stoppedonStop(evt) {// Same properties as onStart},// Filter single elementselectionFilter(evt) {evt.selection; // This selection instanceevt.eventName; // The event nameevt.element; // The element which is in the current selection// return true to keep the element in the current selection}});链接: http://www.fly63.com/nav/2164网站地址:https://simonwep.github.io/selection/
GitHub:https://github.com/Simonwep/selection
网站描述:一个用于制作可视化DOM选择的简单,轻量级和现代化的库
Selection.js
官方网站:https://simonwep.github.io/selection/
小编说
以上是编程之家为你收集整理的Selection.js全部内容。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。