Skip to content

๐Ÿ‘†A lightweight swiper component for mobile frontend.

License

Notifications You must be signed in to change notification settings

shenfe/lite-swiper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

31 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

lite-swiper

A lightweight swiper component for mobile frontend.

Demo

Demo

Usage

npm install lite-swiper --save

elements

Ensure a container with [width, height, overflow] styles, an item wrapper, and several items:

<style>
    .container {
        width: 100%;
        height: 200px;
        overflow: hidden;
    }
</style>
<div id="my-swiper" class="container">
    <div class="items">
        <div class="item">item1</div>
        <div class="item">item2</div>
        <div class="item">item3</div>
    </div>
</div>

script

Create an instance like this:

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

About

๐Ÿ‘†A lightweight swiper component for mobile frontend.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published