slick 矢印をカスタマイズ変更する
jQueryプラグイン「slick」に使われる矢印を別の形に変更します。変更する方法はCSSを貼り付けるだけで実現できます。
デフォルト矢印
See the Pen
slick – autoplay by kura (@kuranopen)
on CodePen.
細い三角矢印
See the Pen
slick – autoplay by kura (@kuranopen)
on CodePen.
CSS
.slick-arrow {
display: block;
position: absolute;
top: 0;
bottom: 0;
margin: auto;
padding: 0;
width: 20px;
height: 38px;
color: transparent;
z-index: 1;
transition: opacity 0.5s;
z-index: 1;
}
.slick-arrow:hover {
opacity: 0.7;
}
/* 共通設定 */
.slick-next::before,
.slick-next::after,
.slick-prev::before,
.slick-prev::after {
position: absolute;
top: 0;
bottom: 0;
margin: auto;
content: "";
vertical-align: middle;
}
.slick-next::before,
.slick-prev::before {
width: 36px;
height: 1px;
background: #fff;
}
.slick-next::after,
.slick-prev::after {
width: 26px;
height: 26px;
border-top: 1px solid #fff;
border-right: 1px solid #fff;
}
/* next */
.slick-next {
right: 26px;
}
.slick-next::before {
right: 0;
}
.slick-next::after {
right: 4px;
transform: rotate(45deg);
}
/* prev */
.slick-prev {
left: 26px;
}
.slick-prev::before {
left: 0;
}
.slick-prev::after {
left: 4px;
transform: rotate(-135deg);
}
@media screen and (max-width: 767px) {
.slick-next::before,
.slick-prev::before {
width: 18px;
}
.slick-next::after,
.slick-prev::after {
width: 10px;
height: 10px;
}
.slick-next {
right: 8px;
}
.slick-prev {
left: 8px;
}
.slick-prev::before {
left: 2px;
}
.slick-next::after {
right: 2px;
}
}
細い「く」の字矢印
See the Pen
slick – autoplay by kura (@kuranopen)
on CodePen.
CSS
.slick-arrow {
display: block;
position: absolute;
top: 0;
bottom: 0;
margin: auto;
padding: 0;
width: 20px;
height: 38px;
color: transparent;
z-index: 1;
transition: opacity 0.5s;
z-index: 1;
}
.slick-arrow:hover {
opacity: 0.7;
}
/* 共通設定 */
.slick-next::before,
.slick-next::after,
.slick-prev::before,
.slick-prev::after {
position: absolute;
top: 0;
bottom: 0;
margin: auto;
content: "";
vertical-align: middle;
}
.slick-next::after,
.slick-prev::after {
width: 26px;
height: 26px;
border-top: 1px solid #fff;
border-right: 1px solid #fff;
}
/* next */
.slick-next {
right: 26px;
}
.slick-next::after {
right: 4px;
transform: rotate(45deg);
}
/* prev */
.slick-prev {
left: 26px;
}
.slick-prev::after {
left: 4px;
transform: rotate(-135deg);
}
@media screen and (max-width: 767px) {
.slick-next::after,
.slick-prev::after {
width: 10px;
height: 10px;
}
.slick-next {
right: 8px;
}
.slick-prev {
left: 8px;
}
.slick-next::after {
right: 2px;
}
}