{"id":13549305,"url":"https://github.com/thebird/Swipe","last_synced_at":"2025-04-02T22:31:38.626Z","repository":{"id":1445866,"uuid":"1676966","full_name":"thebird/Swipe","owner":"thebird","description":"Swipe is the most accurate touch slider.","archived":false,"fork":false,"pushed_at":"2020-05-12T17:10:27.000Z","size":1814,"stargazers_count":6782,"open_issues_count":245,"forks_count":1681,"subscribers_count":314,"default_branch":"master","last_synced_at":"2025-03-10T21:49:39.981Z","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/thebird.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-04-28T17:57:25.000Z","updated_at":"2025-03-02T18:25:32.000Z","dependencies_parsed_at":"2022-07-07T12:44:07.242Z","dependency_job_id":null,"html_url":"https://github.com/thebird/Swipe","commit_stats":null,"previous_names":["bradbirdsall/swipe"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thebird%2FSwipe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thebird%2FSwipe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thebird%2FSwipe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thebird%2FSwipe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thebird","download_url":"https://codeload.github.com/thebird/Swipe/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246905145,"owners_count":20852812,"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-08-01T12:01:20.435Z","updated_at":"2025-04-02T22:31:38.337Z","avatar_url":"https://github.com/thebird.png","language":"JavaScript","readme":"## Usage\nSwipe only needs to follow a simple pattern. Here is an example:\n\n``` html\n\u003cdiv id='slider' class='swipe'\u003e\n  \u003cdiv class='swipe-wrap'\u003e\n    \u003cdiv\u003e\u003c/div\u003e\n    \u003cdiv\u003e\u003c/div\u003e\n    \u003cdiv\u003e\u003c/div\u003e\n  \u003c/div\u003e\n\u003c/div\u003e\n```\n\nAbove is the initial required structure– a series of elements wrapped in two containers. Place any content you want within the items. The containing div will need to be passed to the Swipe function like so:\n\n``` js\nwindow.mySwipe = Swipe(document.getElementById('slider'));\n```\n\nI always place this at the bottom of the page, externally, to verify the page is ready.\n\nAlso Swipe needs just a few styles added to your stylesheet:\n\n``` css\n.swipe {\n  overflow: hidden;\n  visibility: hidden;\n  position: relative;\n}\n.swipe-wrap {\n  overflow: hidden;\n  position: relative;\n}\n.swipe-wrap \u003e div {\n  float:left;\n  width:100%;\n  position: relative;\n}\n```\n\n## Config Options\n\nSwipe can take an optional second parameter– an object of key/value settings:\n\n- **startSlide** Integer *(default:0)* - index position Swipe should start at\n\n-\t**speed** Integer *(default:300)* - speed of prev and next transitions in milliseconds.\n\n- **auto** Integer - begin with auto slideshow (time in milliseconds between slides)\n\n- **continuous** Boolean *(default:true)* - create an infinite feel with no endpoints\n\n- **disableScroll** Boolean *(default:false)* - stop any touches on this container from scrolling the page\n\n- **stopPropagation** Boolean *(default:false)* - stop event propagation\n \n-\t**callback** Function - runs at slide change.\n\n- **transitionEnd** Function - runs at the end slide transition.\n\n### Example\n\n``` js\n\nwindow.mySwipe = new Swipe(document.getElementById('slider'), {\n  startSlide: 2,\n  speed: 400,\n  auto: 3000,\n  continuous: true,\n  disableScroll: false,\n  stopPropagation: false,\n  callback: function(index, elem) {},\n  transitionEnd: function(index, elem) {}\n});\n\n```\n\n## Swipe API\n\nSwipe exposes a few functions that can be useful for script control of your slider.\n\n`prev()` slide to prev\n\n`next()` slide to next\n\n`getPos()` returns current slide index position\n\n`getNumSlides()` returns the total amount of slides\n\n`slide(index, duration)` slide to set index position (duration: speed of transition in milliseconds)\n\n## Browser Support\nSwipe is now compatible with all browsers, including IE7+. Swipe works best on devices that support CSS transforms and touch, but can be used without these as well. A few helper methods determine touch and CSS transition support and choose the proper animation methods accordingly.\n\n## Who's using Swipe\n- CNN\n- Craigslist\n- Airbnb\n- NHL\n- many more…\n\n## License\nCopyright (c) 2013 Brad Birdsall Licensed under the [The MIT License (MIT)](http://opensource.org/licenses/MIT).\n","funding_links":[],"categories":["JavaScript","Framework or Library","13. 页面交互"],"sub_categories":["Mobile Related","13.1 Slider ###","13.1 Slider"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthebird%2FSwipe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthebird%2FSwipe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthebird%2FSwipe/lists"}