{"id":20534706,"url":"https://github.com/nagilum/swipe","last_synced_at":"2025-07-11T16:37:38.060Z","repository":{"id":22023306,"uuid":"25349382","full_name":"nagilum/swipe","owner":"nagilum","description":"Simple library to enable swipe on webpages","archived":false,"fork":false,"pushed_at":"2014-10-30T07:10:06.000Z","size":200,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-06T03:16:45.833Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/nagilum.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":"2014-10-17T09:11:04.000Z","updated_at":"2014-10-21T08:18:29.000Z","dependencies_parsed_at":"2022-08-20T14:40:33.324Z","dependency_job_id":null,"html_url":"https://github.com/nagilum/swipe","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nagilum/swipe","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nagilum%2Fswipe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nagilum%2Fswipe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nagilum%2Fswipe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nagilum%2Fswipe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nagilum","download_url":"https://codeload.github.com/nagilum/swipe/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nagilum%2Fswipe/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264852668,"owners_count":23673471,"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-11-16T00:27:51.447Z","updated_at":"2025-07-11T16:37:37.822Z","avatar_url":"https://github.com/nagilum.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Swipe\n\nSimple Javascript library to enable swipe on webpages without the use of\nadditional libraries like jQuery. It can track multiple elements and multiple\nfinger touches.\n\n## Usage\n\nFirstly you just need to include the library as such:\n\n```html\n\u003cscript src=\"swipe.js\"\u003e\u003c/script\u003e\n```\n\nThen you'll need a callback function for when a swipe is completed:\n\n```js\n/**\n * This is the callback function the swipe library will init when the swipe\n * event is completed.\n *\n * @param string id\n *   The ID of the element that was swiped.\n * @param int angle\n *   The overall angle of the swipe.\n * @param int length\n *   The overall length of the swipe.\n * @param string direction4axis\n *   The direction of the swipe, ie 'w', 'e', 'n', or 's'.\n * @param string direction8axis\n *   A more detailed direction, ie: 'w', 'sw', 's', 'se', 'e', 'ne', 'n', or 'nw'.\n * @param int fingerCount\n *   The number of fingers used for the swipe.\n * @param element element\n *   The element where the swipe originated.\n */\nfunction swipeCompleted(id, angle, length, direction4axis, direction8axis, fingerCount, element) {\n  alert('Element with ID: ' + id + ' was just swiped ' + direction + ' with ' + fingerCount + ' finger(s).');\n}\n```\n\nAnd finally you just call forth and attach the swipe to an element, as such:\n\n```js\n// attachSwipe(\n//   'id-of-element',\n//   number-of-fingers,\n//   callback-function,\n//   prevent-default-click/touch-events,\n//   minimum-swipe-length);\n//\n// The callback function is a function you create which will be called when\n// the swipe is completed The last argument isn't required and defaults to\n// false if not set.\n\n// Example:\nattachSwipe('divBoxForSwipe', 1, swipeCompleted);\n\n// If you don't want to limit the number of fingers to track, aka can use any number of fingers to swipe, use this:\nattachSwipe('divBoxForSwipe', null, swipeCompleted);\n```\n\nYou can also supress default behaviour of the underlying controls by adding a fourth argument.\n\n```js\n// Now other click/touch events on the element won't trigger.\nattachSwipe('mySwipeBox', 2, swipeCompleted, true);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnagilum%2Fswipe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnagilum%2Fswipe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnagilum%2Fswipe/lists"}