prevButton
后退按钮的css选择器或HTML元素。
prevButton参数
- 类型:
- string / HTMLElement
- 默认:
- null
- 举例:
- .swiper-button-prev
- 启用版本:
- 3.0.0
效果演示
修改箭头的颜色:除了默认的蓝色箭头外,Swiper还内置了白色 < 和黑色 < 两种箭头颜色,如需其他颜色可更改css样式中的fill%3D'%23007aff'详见下方代码示例。
使用方法示例
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide">Slide 1</div>
<div class="swiper-slide">Slide 2</div>
<div class="swiper-slide">Slide 3</div>
</div>
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
</div>
<script language="javascript">
var mySwiper = new Swiper('.swiper-container',{
prevButton:'.swiper-button-prev',
nextButton:'.swiper-button-next',
})
</script>
<!-- 修改箭头颜色示范 -->
<div class="swiper-button-prev swiper-button-white"></div> <!-- 白色 -->
<div class="swiper-button-prev swiper-button-black"></div> <!-- 黑色 -->
<style>
/*Swiper原样式 */
.swiper-button-prev{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M0%2C22L22%2C0l2.1%2C2.1L4.2%2C22l19.9%2C19.9L22%2C44L0%2C22L0%2C22L0%2C22z'%20fill%3D'%23007aff'%2F%3E%3C%2Fsvg%3E");}
/*改变了颜色和加粗的样式*/
.swiper-button-prev{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M0%2C22L22%2C0l4.2%2C4.2L8.4%2C22l17.8%2C17.8L22%2C44L0%2C22z'%20fill%3D'%23ff6600'%2F%3E%3C%2Fsvg%3E");}
</style>
转载原创文章请注明:文章转载自:Swiper中文网 [https://3.swiper.com.cn]
本文地址:https://3.swiper.com.cn/api/Navigation_Buttons/2015/0308/210.html
上一篇:nextButton
下一篇:没有了