Web前端开发网

web.fly63.com

首页 资源 工具 文章 教程 栏目
  • 在线搜索
  • 文章标签
  • 文章投稿
  • 关于我们
资源分类
AI智能酷站推荐招聘/兼职框架/库模块/管理移动端UI框架Web-UI框架Js插件CSS相关在线工具建站资源 更多
网站收录 / 问题反馈

Selection.js

分享
复制链接
新浪微博
QQ 好友

扫一扫分享

Selection.js
网站地址:https://simonwep.github.io/selection/
GitHub:https://github.com/Simonwep/selection
描述信息:一个用于制作可视化DOM选择的简单,轻量级和现代化的库
访问官网
GitHub

 一个简单轻量级的库,用于实现可视DOM选择,例如在桌面上。没有jQuery。支持任何CSS库,例如Bootstrap。包括垂直和水平滚动支持。 


特征

  • 支持触摸设备
  • 用法简单
  • 没有jQuery
  • 垂直和水平滚动支持


安装

通过npm

npm 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-element
    class: 'selection-area',

    // px, how many pixels the point should move before starting the selection
    startThreshold: 10,

    // Disable the selection functionality for touch devices
    disableTouch: 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 selected
    selectables: [],

    // Query selectors for elements from where a selection can be start
    startareas: ['html'],

    // Query selectors for elements which will be used as boundaries for the selection
    boundaries: ['html'],

    // Query selector or dom node to set up container for selection-area-element
    selectionAreaContainer: '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 details
    onStart(evt) {
        evt.selection;
        evt.eventName;
        evt.areaElement;
        evt.originalEvent;
        evt.selectedElements;
        evt.changedElements;
    },

    // Single-click selection
    onSelect(evt) {
       // Same properties as onStart
       evt.target; // Clicked element
    },

    // Element selection move
    onMove(evt) {
       // Same properties as onStart
    },

    // Element selection stopped
    onStop(evt) {
       // Same properties as onStart
    },

    // Filter single element
    selectionFilter(evt) {
       evt.selection; // This selection instance
       evt.eventName; // The event name
       evt.element;   // The element which is in the current selection
       // return true to keep the element in the current selection
    }
});




仅供个人学习参考/导航指引使用,具体请以第三方网站说明为准,本站不提供任何专业建议。如果地址失效或描述有误,请联系站长反馈~感谢您的理解与支持!

链接: https://web.fly63.com/nav/2164

更多»
热门资源
Vue
Vue.js是一套构建用户界面的渐进式JavaScript框架
官网
GitHub
react
Facebook开发的一款高效、灵活、声明式设计的JS库
官网
GitHub
AngularJS
Google推出有条理,可维护,易编程的MVVM框架
官网
GitHub
backbone
提供:模型、集合、视图,开发重量级的javascript应用的框架
官网
GitHub
jquery
一个快速、简洁的JavaScript代码库
官网
GitHub
zepto.js
一个轻量级的针对现代高级浏览器的JavaScript库
官网
GitHub
Ember
JavaScript MVC框架,它用来创建复杂的Web应用程序,消除了样板
官网
GitHub
nw.js
轻量级桌面应用开发的捷径
官网
GitHub
socket.io
一个WebSocket库,包括了客户端的js和服务器端的nodejs
官网
GitHub
nuxt.js
基于 Vue.js 的轻量级、服务端渲染 (SSR) 应用框架
官网
GitHub
Next.js
实现react的服务端渲染的框架
官网
GitHub
Electron
基于Chromium 和 Node.js, 使用 JavaScript, HTML 和 CSS 构建跨平台的桌面应用
官网
GitHub
类似于Selection.js的资源
Sugar.js
在原生对象上增加一些工具方法
官网
GitHub
react-motion
一个 React 弹性动画库,使用 0-10 的弹性参数进行动画处理
官网
GitHub
ramda
一个为 JavaScript 开发者准备的实用的函数式编程
官网
GitHub
lovli.js
让你在几分钟内开发实时应用程序
点击进入
GitHub
SvelteKit
一个基于 Svelte 框架构建的全栈 Web 应用程序开发框架
官网
GitHub
Licia
一套在开发中实践积累起来的实用JavaScript工具库
官网
GitHub
IronJS
一个.NET的JavaScript实现
官网
GitHub
Chameleon
一套代码运行多端,一端所见即多端所见
官网
GitHub
目录

手机扫一扫预览

首页 技术导航 在线工具 技术文章 教程资源 前端标签 AI工具集 前端库/框架

Copyright © 2018 Web前端开发网 All Rights Reserved. 分享编程学习资源(教程/框架/库)、在线工具、技术教程、内容以学习参考为主,助您解决各类实际问题,快速提升专业能力。