{"id":16355951,"url":"https://github.com/timobechtel/draggins","last_synced_at":"2026-01-21T17:36:53.324Z","repository":{"id":38174724,"uuid":"260583947","full_name":"TimoBechtel/draggins","owner":"TimoBechtel","description":"Make things draggable on mobile or desktop","archived":false,"fork":false,"pushed_at":"2023-03-04T15:41:09.000Z","size":1860,"stargazers_count":1,"open_issues_count":9,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-17T22:54:40.630Z","etag":null,"topics":["drag","draggable","javascript","mobile","web"],"latest_commit_sha":null,"homepage":"https://timobechtel.github.io/draggins/","language":"TypeScript","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/TimoBechtel.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-02T00:17:07.000Z","updated_at":"2023-03-07T02:39:31.000Z","dependencies_parsed_at":"2024-10-28T15:21:05.605Z","dependency_job_id":"44aa3dd9-0e71-40f1-bbde-e149c2542f24","html_url":"https://github.com/TimoBechtel/draggins","commit_stats":{"total_commits":31,"total_committers":4,"mean_commits":7.75,"dds":0.6129032258064516,"last_synced_commit":"692e40d62af55b67a95d72a17280893f8895258f"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimoBechtel%2Fdraggins","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimoBechtel%2Fdraggins/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimoBechtel%2Fdraggins/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimoBechtel%2Fdraggins/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TimoBechtel","download_url":"https://codeload.github.com/TimoBechtel/draggins/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247779789,"owners_count":20994569,"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":["drag","draggable","javascript","mobile","web"],"created_at":"2024-10-11T01:42:13.988Z","updated_at":"2026-01-21T17:36:53.294Z","avatar_url":"https://github.com/TimoBechtel.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003edraggins\u003c/h1\u003e\n\u003ch3 align=\"center\"\u003eMake things draggable on mobile or desktop.\u003c/h3\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/draggins\" target=\"_blank\"\u003e\n    \u003cimg alt=\"Version\" src=\"https://img.shields.io/npm/v/draggins.svg\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/TimoBechtel/draggins/blob/main/LICENSE\" target=\"_blank\"\u003e\n    \u003cimg alt=\"License: MIT\" src=\"https://img.shields.io/github/license/TimoBechtel/draggins\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  ·\n  \u003ca href=\"https://github.com/TimoBechtel/draggins#readme\"\u003eHomepage\u003c/a\u003e\n  ·\n  \u003ca href=\"https://timobechtel.github.io/draggins/\"\u003eView Demo\u003c/a\u003e\n  ·\n  \u003ca href=\"https://github.com/TimoBechtel/draggins/issues\"\u003eReport Bug / Request Feature\u003c/a\u003e\n  ·\n\u003c/p\u003e\n\n## Table of Contents\n\n- [Installation](#Install)\n- [Usage](#usage)\n- [Test](#run-tests)\n- [Contact](#contact)\n- [Contributing](#Contributing)\n- [License](#license)\n\n## Install\n\n### NPM:\n\n```sh\nnpm install draggins\n```\n\n### CDN:\n\n```html\n\u003cscript src=\"https://unpkg.com/draggins/dist/index.umd.js\"\u003e\u003c/script\u003e\n```\n\n## Usage\n\n### As module:\n\n```javascript\nimport { draggable } from 'draggins';\n```\n\nThen:\n\n```javascript\ndraggable('.draggable');\n```\n\nYou can use it easily with [Svelte](https://svelte.dev/):\n\n```html\n\u003cscript\u003e\n  import { draggable } from 'draggins';\n  // discard return value as svelte expects its own api:\n  const isDraggable = (el) =\u003e void draggable(el);\n\u003c/script\u003e\n\u003cdiv use:isDraggable\u003eI'm draggable\u003c/div\u003e\n```\n\n### More examples:\n\n```javascript\nconst dragApi = draggable('.draggable', {\n  onDragStart: (position) =\u003e console.log(position),\n  onDragEnd: (position) =\u003e console.log(position),\n});\ndocument.getElementById('toggle').addEventListener('click', (e) =\u003e {\n  dragApi.setDraggableState(e.target.checked);\n});\n```\n\nDocs:\n\n```typescript\n/**\n * Make things draggable\n * @param element can be a range of different inputs, see https://github.com/CompactJS/uea\n * @param options draggable options\n * @returns returns api\n */\nfunction draggable(\n  element: string | HTMLElement | HTMLElement[] | HTMLCollection | NodeList,\n  options?: DraggableOptions\n): DraggableAPI;\n\ninterface DraggableAPI {\n  /**\n   * disable / enable dragging\n   * @param state draggable\n   */\n  setDraggableState(state: boolean): void;\n}\n\ninterface DraggableOptions {\n  /**\n   * limit dragging to a boundary box\n   * set it to 'null' to disable\n   * defaults to window width/height\n   */\n  limit?: { x: { min: number; max: number }; y: { min: number; max: number } };\n  /**\n   * stop dragging when mouse is out of boundaries\n   * @default false\n   */\n  cancelWhenOutOfBoundary?: boolean;\n  /**\n   * draggins by default changes z-index to 99\n   * @default false\n   */\n  dontTouchStyles?: boolean;\n\n  /**\n   * Run when dragging has started\n   */\n  onDragStart?: (position: { x: number; y: number }) =\u003e void;\n\n  /**\n   * Run when dragging has ended\n   */\n  onDragEnd?: (position: { x: number; y: number }) =\u003e void;\n}\n```\n\n## Run tests\n\n```sh\nnpm run test\n```\n\n## Contact\n\n👤 **Timo Bechtel**\n\n- Website: https://timobechtel.com\n- Twitter: [@TimoBechtel](https://twitter.com/TimoBechtel)\n- GitHub: [@TimoBechtel](https://github.com/TimoBechtel)\n\n## 🤝 Contributing\n\nContributions, issues and feature requests are welcome!\u003cbr /\u003e\n\n1. Check [issues](https://github.com/TimoBechtel/draggins/issues)\n1. Fork the Project\n1. Create your Feature Branch (`git checkout -b feat/AmazingFeature`)\n1. Test your changes `npm run test`\n1. Commit your Changes (`git commit -m 'feat: add amazingFeature'`)\n1. Push to the Branch (`git push origin feat/AmazingFeature`)\n1. Open a Pull Request\n\n### Commit messages\n\nThis project uses semantic-release for automated release versions. So commits in this project follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0-beta.2/) guidelines. I recommend using [commitizen](https://github.com/commitizen/cz-cli) for automated commit messages.\n\n## Show your support\n\nGive a ⭐️ if this project helped you!\n\n## 📝 License\n\nDistributed under the [MIT](https://github.com/TimoBechtel/draggins/blob/main/LICENSE) License.\n\n---\n\n_This README was generated with ❤️ by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimobechtel%2Fdraggins","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimobechtel%2Fdraggins","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimobechtel%2Fdraggins/lists"}