https://github.com/shenfe/lite-swiper
👆A lightweight swiper component for mobile frontend.
https://github.com/shenfe/lite-swiper
ui-component
Last synced: over 1 year ago
JSON representation
👆A lightweight swiper component for mobile frontend.
- Host: GitHub
- URL: https://github.com/shenfe/lite-swiper
- Owner: shenfe
- License: mit
- Created: 2017-07-19T15:30:26.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-12-26T12:33:58.000Z (over 8 years ago)
- Last Synced: 2025-02-25T13:37:46.535Z (over 1 year ago)
- Topics: ui-component
- Language: JavaScript
- Homepage:
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# lite-swiper
A lightweight swiper component for mobile frontend.
## Demo
[Demo](http://shenfe.github.io/repos/lite-swiper/demo.html)
## Usage
```bash
npm install lite-swiper --save
```
### elements
Ensure a container with [`width`, `height`, `overflow`] styles, an item wrapper, and several items:
```html
.container {
width: 100%;
height: 200px;
overflow: hidden;
}
item1
item2
item3
```
### script
Create an instance like this:
```js
var Swipe = require('lite-swiper');
var $target = document.getElementById('my-swiper');
var mySwiper = new Swipe($target, {
cssText: {
item: '',
indicators: '',
indicator: '',
indicatorCurrent: ''
},
onmoved: function (index, indexBefore) {
console.log(`moved from ${indexBefore} to ${index}`);
}
});
```
## License
MIT