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,// dis able the selection functionality for touch devices dis abl eto uch: 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 dis ables 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/
如果觉得 网站内容还不错,欢迎将 网站 推荐给程序员好友。
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did175648