Selection.js

编程之家收集整理的这个编程导航主要介绍了Selection.js编程之家,现在分享给大家,也给大家做个参考。

Selection.js

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/

如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。

相关文章

johnny-five,Bocoup 的 JavaScript 机器和物联网编程框架
WePY,一款让小程序支持组件化开发的框架
Deep playground,神经网络的交互式可视化,使用d3.js和TypeS...
ShareDB,用于并发编辑系统的前端数据库
RxJS,RxJS 是使用 Observables 的响应式编程的库
egg-react-ssr,最小而美的Egg + React + SSR 服务端渲染应用...