Selection.js
美国
程序代码 框架/库

Selection.js

一个用于制作可视化DOM选择的简单,轻量级和现代化的库

爱站权重:PC 百度权重移动 百度移动权重
其他站点: 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
    }
});

数据统计

数据评估

Selection.js浏览人数已经达到6,如你需要查询该站的相关权重信息,可以点击"爱站数据""Chinaz数据"进入;以目前的网站数据参考,建议大家请以爱站数据为准,更多网站价值评估因素如:Selection.js的访问速度、搜索引擎收录以及索引量、用户体验等;当然要评估一个站的价值,最主要还是需要根据您自身的需求以及需要,一些确切的数据则需要找Selection.js的站长进行洽谈提供。如该站的IP、PV、跳出率等!

关于Selection.js特别声明

本站东辰资源网提供的Selection.js都来源于网络,不保证外部链接的准确性和完整性,同时,对于该外部链接的指向,不由东辰资源网实际控制,在2021年10月7日 下午6:54收录时,该网页上的内容,都属于合规合法,后期网页的内容如出现违规,可以直接联系网站管理员进行删除,东辰资源网不承担任何责任。

相关导航

暂无评论

暂无评论...