swipe.js 使用方法

时间:2024-02-17 21:35:37

 

 

1.插件要求的css样式:

<style>
.swipe {
overflow: hidden;
visibility: hidden;
position: relative;
}
.swipe-wrap {
overflow: hidden;
position: relative;
}
.swipe-wrap > li {
float:left;
width:100%;
position: relative;
}

</style>

2.JS代码:

<script>
var el = document.querySelector(\'.view\');
var mySwipe = Swipe(el, {
startSlide: 6,
auto: 2000,
callback: function(key, el) {

},
transitionEnd: function(index, elem) {
console.log(index, elem);
}
});
</script>