如何设计prev/下一个箭头按钮?

时间:2022-08-23 22:40:00

GOAL

目标

I've been trying to modify the slick.css to fit the style I need in my site. I got the slick.css from here.

我一直在努力修改这个圆滑的东西。css以适应我的网站需要的风格。我有浮油。css。

Now

现在

  • I want to make the arrow (left + right) bigger
  • 我想让箭头(左+右)变大
  • For icons, I want to use the one with no circle-border around it.
  • 对于图标,我想使用没有圆圈边框的图标。
  • I like fa-chevron-right and fa-chevron-left
  • 我喜欢fa-chevron-right和fa-chevron-left

What have I tried ?

我试过什么?

portion of slick.css

部分slick.css

.slick-prev, .slick-next { position: absolute; display: block; height: 200px; width: 50px; line-height: 0; font-size: 0; cursor: pointer; background: transparent; color: transparent; top: 50%; margin-top: -10px; padding: 0; border: none; outline: none; }
.slick-prev:hover, .slick-prev:focus, .slick-next:hover, .slick-next:focus { outline: none; background: transparent; color: transparent; }
.slick-prev:hover:before, .slick-prev:focus:before, .slick-next:hover:before, .slick-next:focus:before { opacity: 1; }
.slick-prev.slick-disabled:before, .slick-next.slick-disabled:before { opacity: 0.25; }

.slick-prev:before, .slick-next:before { font-family: "slick"; font-size: 20px; line-height: 1; color: red; opacity: 0.75; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }



.slick-prev { left: -10px; top: 70px;  }
[dir="rtl"] .slick-prev { left: auto; right: -10px; top: 70px; }
.slick-prev:before { content: "←"; }
[dir="rtl"] .slick-prev:before { content: "→"; }

.slick-next { right: -10px; top: 70px; }
[dir="rtl"] .slick-next { left: -10px; top: 70px; right: auto; }
.slick-next:before { content: "→"; }
[dir="rtl"] .slick-next:before { content: "←"; }

HTML

HTML

<div class="row slick ">
// just a bunch of lists in here
</div>

Detail Photo

细节的照片

Here is what I have now.

这是我现在所拥有的。

如何设计prev/下一个箭头按钮?

Here is what I want to have.

这是我想要的。

如何设计prev/下一个箭头按钮?


Question

问题

  • Can someone help me resolve this ?

    有人能帮我解决这个问题吗?

    I really appreciate your consideration and time. :)

    非常感谢您的考虑和时间。:)

3 个解决方案

#1


19  

The Basic thing is its producing arrows by content property:

最基本的是根据内容属性生成箭头:

.slick-prev:before, .slick-next:before { font-family: "slick"; font-size: 40px; line-height: 1; color: red; opacity: 0.75; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }   

.slick-prev:before { content: "‹"; }
[dir="rtl"] .slick-prev:before { content: "›"; }

[dir="rtl"] .slick-next { left: -10px; top: 70px; right: auto; }
.slick-next:before { content: "›"; }
[dir="rtl"] .slick-next:before { content: "‹"; }

Replace these classes and after that just play with margin and positions properties to adjust the arrows, if this didnot fix the issue send me the http://jsfiddle.net/ link i will send you the complete solution.

替换这些类,然后使用边距和位置属性来调整箭头,如果这没有解决问题,请将http://jsfiddle.net/ link发送给我,我将向您发送完整的解决方案。

If want to use Font Awesome

如果想用字体很棒

.slick-prev:before, .slick-next:before { font-family: FontAwesome; font-size: 40px; line-height: 1; color: red; opacity: 0.75; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }   

.slick-prev:before { content: "\f053"; }
[dir="rtl"] .slick-prev:before { content: "\f054"; }

[dir="rtl"] .slick-next { left: -10px; top: 70px; right: auto; }
.slick-next:before { content: "\f054"; }
[dir="rtl"] .slick-next:before { content: "\f053"; }

For list of Font icons visit http://astronautweb.co/snippet/font-awesome/ and how to implement the font visit this thread Use font awesome icon as css content

对于字体图标的访问,请访问http://cntweb。co/snippet/font-awesome/和如何实现字体访问这个线程使用字体awesome图标作为css内容

#2


2  

.slick-prev::before {
    font-family: FontAwesome;
    content: "\f0d9";
    font-size: 22px;
}  
.slick-next::before {
    font-family: FontAwesome;
    content:  "\f0da";
    font-size: 22px;        
}      
<link href="http://fontawesome.io/assets/font-awesome/css/font-awesome.css" rel="stylesheet"/>

<button type="button" class="slick-prev "></button>

<button type="button" class="slick-next "></button>

#3


1  

If you are using sass you can set sass variables provided by slick.

如果您正在使用sass,您可以设置由slick提供的sass变量。

Refer: Add custom buttons on Slick Carousel

参考:在光滑的旋转木马上添加自定义按钮。

#1


19  

The Basic thing is its producing arrows by content property:

最基本的是根据内容属性生成箭头:

.slick-prev:before, .slick-next:before { font-family: "slick"; font-size: 40px; line-height: 1; color: red; opacity: 0.75; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }   

.slick-prev:before { content: "‹"; }
[dir="rtl"] .slick-prev:before { content: "›"; }

[dir="rtl"] .slick-next { left: -10px; top: 70px; right: auto; }
.slick-next:before { content: "›"; }
[dir="rtl"] .slick-next:before { content: "‹"; }

Replace these classes and after that just play with margin and positions properties to adjust the arrows, if this didnot fix the issue send me the http://jsfiddle.net/ link i will send you the complete solution.

替换这些类,然后使用边距和位置属性来调整箭头,如果这没有解决问题,请将http://jsfiddle.net/ link发送给我,我将向您发送完整的解决方案。

If want to use Font Awesome

如果想用字体很棒

.slick-prev:before, .slick-next:before { font-family: FontAwesome; font-size: 40px; line-height: 1; color: red; opacity: 0.75; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }   

.slick-prev:before { content: "\f053"; }
[dir="rtl"] .slick-prev:before { content: "\f054"; }

[dir="rtl"] .slick-next { left: -10px; top: 70px; right: auto; }
.slick-next:before { content: "\f054"; }
[dir="rtl"] .slick-next:before { content: "\f053"; }

For list of Font icons visit http://astronautweb.co/snippet/font-awesome/ and how to implement the font visit this thread Use font awesome icon as css content

对于字体图标的访问,请访问http://cntweb。co/snippet/font-awesome/和如何实现字体访问这个线程使用字体awesome图标作为css内容

#2


2  

.slick-prev::before {
    font-family: FontAwesome;
    content: "\f0d9";
    font-size: 22px;
}  
.slick-next::before {
    font-family: FontAwesome;
    content:  "\f0da";
    font-size: 22px;        
}      
<link href="http://fontawesome.io/assets/font-awesome/css/font-awesome.css" rel="stylesheet"/>

<button type="button" class="slick-prev "></button>

<button type="button" class="slick-next "></button>

#3


1  

If you are using sass you can set sass variables provided by slick.

如果您正在使用sass,您可以设置由slick提供的sass变量。

Refer: Add custom buttons on Slick Carousel

参考:在光滑的旋转木马上添加自定义按钮。