更新时间:2018/1/9 上午11:47:04
更新说明:修正载入的方式为 对象.swiper({参数}) ,兼容IE8、9、10
发布时间:2018-1-9 0:09
在样式表中对对象的max-width设置宽度,并且在参数中设置好宽高比即可使用。
在<script>标签中windows.onload调用:对象.swiper({参数})
例如:
.box {
max - width: 720 px; /*** 这里的max-width值就是图片的宽度 ***/
}.box1 {
max - width: 750 px; /*** 这里的max-width值就是图片的宽度 ***/
}$("#box1").swiper({
ratio: 8 / 5,
time: 4000,
stop: true,
direction: "left"
});
$("#box").swiper({
time: 2000,
base: false,
ratio: 290 / 163
});具体参数如下:
direction:"right", //如果设置自动滚动,值为"left"向左,值为"right"向右 默认"right"
ratio:16/9, //设置图片宽高比 默认16/9
time:3000, //自动滚动间隔,单位:毫秒,为0时不自动滚动 默认3秒
base:!0, //是否创建底部按钮,值为"true"或"flase" 默认"true"
btn:!0, //是否显示左右按钮,值为"true"或"flase" 默认"true"
over:!0, //是否拥有鼠标经过动画,值为"true"或"flase" 默认"true"
stop: !0, //是否鼠标悬停停止滚动,值为"true"或"flase" 默认"true"