Swiper中关于前进后退按钮修改箭头颜色

修改箭头的颜色:

除了默认的蓝色箭头外,Swiper还内置了白色   >     和黑色   >     两种箭头颜色,如需其他颜色可更改css样式中的   fill%3D'%23007aff'。后退按钮同效。

1.当需要将navigation中前进后退按钮颜色改成黑白,只要添加类swiper-button-white或者swiper-button-black就可以.

2.如果需要修改成其他颜色,那么例如下面这个:

改变前为默认蓝色:

.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'%23007aff'%2F%3E%3C%2Fsvg%3E");
    width: 12%;
    height: 6%;
}
.swiper-button-next{
	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'M27%2C22L5%2C44l-4.2-4.2L18.6%2C22L0.8%2C4.2L5%2C0z'%20fill%3D'%23ffffff'%2F%3E%3C%2Fsvg%3E");
	width: 9%;
    height: 6%;
}

改变后为黄色:

.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'%23ffff00'%2F%3E%3C%2Fsvg%3E");
    width: 12%;
    height: 6%;
}
.swiper-button-next{
    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'M27%2C22L5%2C44l-4.2-4.2L18.6%2C22L0.8%2C4.2L5%2C0z'%20fill%3D'%23ffff00'%2F%3E%3C%2Fsvg%3E");
    width: 9%;
    height: 6%;
}

区别在于:
Swiper中关于前进后退按钮修改箭头颜色_第1张图片
下面有一张我收藏的css样式颜色图片,可以根据这个来改变颜色。
Swiper中关于前进后退按钮修改箭头颜色_第2张图片

你可能感兴趣的:(Swiper中关于前进后退按钮修改箭头颜色)