Skip to content

Wolff-H/pure-draggable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pure-draggable

A javascript library that offers ability of dragging element.

Installation

$ npm install pure-draggable

Usage

Basic

import simpleSraggable from "pure-draggable"

simpleSraggable(draggable)

API

function simpleSraggable(
    draggable: HTMLElement,
    options?:
    {
        hooks?:
        {
            dragStart?: (event: MouseEvent, draggable: HTMLElement, draggable_data: ResizerData) => void|false,
            drag?: (event: MouseEvent, draggable: HTMLElement, draggable_data: ResizerData) => void|false,
            dragEnd?: (event: MouseEvent, draggable: HTMLElement, draggable_data: ResizerData) => void,
        },
        destroy?: boolean,
        avoid?: HTMLElement[],
        handles?: HTMLElement[],
        data?: any,
    },
): DraggableData|void
  • draggable

    The draggable element.

  • options

    Other options.

    • hooks

      Custom hooks.

      • dragStart

        Call when drag starts. Return false to prevent default behaviour.

      • drag

        Call on each drag move. Return false to prevent default behaviour.

      • dragEnd

        Call when drag ends.

    • destroy

      When true, remove draggable ability on the element.

    • avoid

      Drag will not happen on those elements.

    • handles

      Drag will only happen on those elements. When both avoid and handles are defined, only handles take effect.

    • data

      Data that is to be carried on data_transfer.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published