{"id":17197231,"url":"https://github.com/terwanerik/draggable","last_synced_at":"2025-07-10T13:36:25.034Z","repository":{"id":57216072,"uuid":"70406980","full_name":"terwanerik/Draggable","owner":"terwanerik","description":"Using the HTML5 draggable api should not be difficult. This makes it simple to swap elements by dragging.","archived":false,"fork":false,"pushed_at":"2016-11-28T12:38:07.000Z","size":10,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-10T23:44:21.044Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://terwanerik.github.io/Draggable/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/terwanerik.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-09T14:05:24.000Z","updated_at":"2018-10-04T20:59:57.000Z","dependencies_parsed_at":"2022-08-26T15:01:10.595Z","dependency_job_id":null,"html_url":"https://github.com/terwanerik/Draggable","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terwanerik%2FDraggable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terwanerik%2FDraggable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terwanerik%2FDraggable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terwanerik%2FDraggable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/terwanerik","download_url":"https://codeload.github.com/terwanerik/Draggable/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248782278,"owners_count":21160716,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-15T01:55:51.336Z","updated_at":"2025-04-13T20:51:02.468Z","avatar_url":"https://github.com/terwanerik.png","language":"JavaScript","readme":"# Draggable\n[![License](http://img.shields.io/:license-mit-blue.svg)](https://github.com/terwanerik/Draggable/blob/master/LICENSE)\n[![Issues](https://img.shields.io/github/issues/terwanerik/Draggable.svg)](https://github.com/terwanerik/Draggable/issues)\n[![GitHub release](https://img.shields.io/github/release/terwanerik/Draggable.svg?maxAge=2592000)](https://github.com/terwanerik/Draggable/releases)\n[![Bower](https://img.shields.io/bower/v/draggable-elements.svg?maxAge=2592000)](https://github.com/terwanerik/Draggable/)\n[![npm version](https://badge.fury.io/js/draggable-elements.svg)](https://www.npmjs.com/package/draggable-elements)\n[![Package Quality](http://npm.packagequality.com/shield/draggable-elements.svg)](http://packagequality.com/#?package=draggable-elements)\n\nUsing the HTML5 draggable api should not be difficult. This makes it simple to swap elements by dragging.\n\n## How to use?\nIt's quite simple, just add the `draggable.min.js` file to your HTML page. Then construct a new Draggable instance when the page has loaded. Like so:\n\n```html\n\u003cscript src=\"draggable.min.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\ndocument.addEventListener('DOMContentLoaded', function(){\n\tvar elements = document.querySelectorAll('[data-drag]');\n\tvar draggable = new Draggable(elements);\n});\n\u003c/script\u003e\n```\n\nThe construct can take a set of (or a single) HTMLElements, they will be draggable on init. You can also add HTMLElements with the `.add()` method, or clear all draggables by calling the `.clear()` method. Check out the example for a use case.\n\n### HTML\nIf a `data-drag` attribute is added to the html element you can specify certain groups that the element should be swappable with. Aka setting `data-drag='group1'` on a couple of elements, and `data-drag='group2'` to some other elements, you'll be only able to drag elements with `group1` on other elements with `group1`.\n\n## Contributing\nFork, check out `Draggable.js` and enjoy! If you have improvements, start a new branch \u0026 create a pull request when you're all done :)\n\n#### Found an issue?\nOoh snap, well, bugs happen. Please create a new issue and mention the OS and browser (including version) that the issue is occurring on. If you are really kind, make a [minimal, complete and verifiable example](http://stackoverflow.com/help/mcve) and upload that to [codepen](http://codepen.io).","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterwanerik%2Fdraggable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fterwanerik%2Fdraggable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterwanerik%2Fdraggable/lists"}