Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/matheus23/elm-drag-and-drop

Drag and drop with a similar api to html5-drag-and-drop, but implemented within elm.
https://github.com/matheus23/elm-drag-and-drop

Last synced: 15 days ago
JSON representation

Drag and drop with a similar api to html5-drag-and-drop, but implemented within elm.

Awesome Lists containing this project

README

        

# Drag And Drop

I experienced the html5 drag and drop api to be buggy and inconsistend across browsers, but all building blocks to roll a pure-elm version exist: mouseover and mouseleave events, a subscription to mouseup events and voila.

However, I reuse the dragstart event (from the html5 api), so that draggable elements can still receive onclick events.

## Demo

An example can be tested out by cloning the repo locally and running `elm-reactor`:

```sh
$ git clone https://github.com/matheus23/elm-drag-and-drop.git
$ elm-package install
$ elm-reactor
```

Now open a webbrowser and go to `localhost:8000/src/Example.elm`.

## Disclaimer

This package is still under construction and documentation is limited. This may change in the future when the API does not change that much anymore.

## 'Low' level API

Can be found in the module `DragAndDrop`. It is used to implement a higher level API for reorderable lists.

## 'High' level API

Can be found in the module `DragAndDrop.ReorderList` together with `DragAndDrop.Divider`. Can be used to implement a list of things that can be reordered by dragging its elements.