Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

drago

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

drago

Simple, free, draggable solution with throw-a-bility

latest
npmnpm
Version
0.0.5
Version published
Maintainers
1
Created
Source

drago

Simple, free, draggable solution with throw-a-bility

Options

These are the default options drago comes configured with (you can override these).

const defaultOpts = {
  accel: { x: -0.001, y: -0.001 }, // acceleration
  vMax: { x: 80, y: 80 }, // maximum velocity values (for positive throws)
  vMin: { x: -80, y: -80 }, // minimum velocity values (for negative throws)
  drag: { x: 0.95, y: 0.85 }, // mess with these to get smoother / rougher throws
  axis: { x: true, y: true }, // Toggle these to lock draggability to one axis
  restrict: { x: 'opposite', y: 'contain' }, // type of container restriction
};

Types of restrict: opposite // Currently lets you throw so that only 25% is viewable at the min , max. contain // Keep the draggable item inside container none // Let it be free. Probably not useful

How to initialize.

  const $container = document.querySelector('.js-drag-container');
  const $content   = $container.querySelector('.js-drag-content');
  const instance   = new Drago($content, $container, {
    axis: { x: false, y: true }
    drag: { x: 0.95, y: 0.5 },
    // ...etc
  } )

Et tu, brute?

To stop the RAF / Draggability of drago:

  instance.kill();

FAQs

Package last updated on 31 Mar 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