Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vanilla-drag

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vanilla-drag

JavaScript draggable HTML elements

  • 1.0.21
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Vanilla Drag

Build Status

A tiny (5KB) package to allow free dragging of HTML elements.

Example

Installation

npm install --save vanilla-drag

Getting Started

import VanillaDrag from 'vanilla-drag';

const target = document.getElementById('target');
const drag = new VanillaDrag(window, target);

Options

The VanillaDrag constructor takes two arguments.

new VanillaDrag([window], [HTMLElement])

[window]

The current context's window object. 99% of the time this will always be a case of passing in the global variable window.

[HTMLElement]

An instance of a HTMLElement that will have dragging enabled. Jquery users can access an instance of this object using the following Jquery index / method $('#target')[0] or $('#target').get(0). For Jquery collections containing multiple elements, the collection will need to be iterated over and a separate instance of VanillaDrag created for each item.

Keywords

FAQs

Package last updated on 04 Oct 2017

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc