Socket
Socket
Sign inDemoInstall

eriko-dragger.js

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    eriko-dragger.js

A lib to handle dragging event


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Install size
10.9 kB
Created
Weekly downloads
 

Readme

Source

【eriko-dragger.js】

version: v1.1.0
last updated: 2020.5.26

Availability

npm install --save eriko-dragger.js

Usage

Example 1

Assign dragger by calling set methods.

import { ErikoDragger } from 'eriko-dragger.js';

var ed = new ErikoDragger();

ed.setContainer('#card-collector');
ed.setTarget('#cards');
ed.setStartEvent(this.handleDragStartEvent);
ed.setMoveEvent(this.handleDragMovingEvent);
ed.setEndEvent(this.handleDragEndEvent);
ed.setDebounce(500);

ed.launch();
ed.removeDragger();

Example 2

Assign dragger by passing parameter.

import { ErikoDragger } from 'eriko-dragger.js';

const option = {
  startEvent: myStartEvent
  moveEvent: myMoveEvent
  endEvent: myEndEvent
  debounce: 500
}

var ed = new ErikoDragger('#card-collector', '#cards', option);

ed.launch();
ed.removeDragger();

Get Drag Info

Use first default parameter.

function myMoveEvent(event) {
  console.log(event);
}

document

container

nametypeoptionaldefault
containerIdstringno

target

nametypeoptionaldefault
targetIdstringno

option

nametypeoptionaldefault
startEventfunctionyes
moveEventfunctionyes
endEventfunctionyes
debouncenumberyes300

event (default parameter)

nametypedescription
dragStartCoordobject{x, y}
dragMovingCoordobject{x, y}
dragDirectionstringvertical direction + horizontal directoin
dragDirectionFromPrevstringvertical direction + horizontal directoin
dragDistancenumberDrag distance from start position
dragDistanceFromPrevnumberDrag distance from previous position
dragDurationnumberDrag duration
dragTranslatestring{x, y, translate}
sourceEventobjectOriginal event

Keywords

FAQs

Last updated on 26 May 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc