简体   繁体   English

slick.js从箭头上删除focusOnSelect

[英]slick.js removing focusOnSelect from the arrows

I Have slick.js menu working perfect with focusOnSelect: true. 我的slick.js菜单与focusOnSelect: true.完美配合focusOnSelect: true.

Right now the left and right arrows are changing the colours too of the divs, I would like remove this when I click in the arrows, someone can help? 现在左右箭头也在改变div的颜色,我想在单击箭头时将其删除,有人可以帮忙吗?

thank you. 谢谢。

here is my code: https://jsfiddle.net/wv4f2hda/3/ 这是我的代码: https : //jsfiddle.net/wv4f2hda/3/

edit: sorry I think I was not clear, what I am trying to do is: when I click in the arrows not change my div colours? 编辑:对不起,我想我不清楚,我想做的是:当我单击箭头时不更改div颜色吗? right now if I click the colours change, I would like remove that. 现在,如果我单击颜色更改,我想将其删除。

html: 的HTML:

<h1> Slick Carousel Center mode </h1>
</h1>
<div class="slider">
  <div>
    <div class="slide-h3">
     <i class="fa fa-lg fa-trash"></i>
    <h3>
    1
    </h3></div>
  </div>
  <div>
      <div class="slide-h3">
     <i class="fa fa-lg fa-trash"></i>
    <h3>
    2
    </h3></div>
  </div>
  <div>
   <div class="slide-h3">
     <i class="fa fa-lg fa-trash"></i>
    <h3>
    3
    </h3></div>
  </div>
  <div>
    <div class="slide-h3">
     <i class="fa fa-lg fa-trash"></i>
    <h3>
   4
    </h3></div>
  </div>
  <div>
     <div class="slide-h3">
     <i class="fa fa-lg fa-trash"></i>
    <h3>
    5
    </h3></div>
  </div>

</div>

js: js:

 $(document).ready(function() {
   $('.slider').slick({
     centerMode: true,
     centerPadding: '60px',
     slidesToShow: 4,
     speed: 1500,
     index: 2,
     focusOnSelect:true,
     responsive: [{
       breakpoint: 768,
       settings: {
         arrows: true,
         centerMode: true,
         centerPadding: '40px',
         slidesToShow: 3
       }
     }, {
       breakpoint: 480,
       settings: {
         arrows: false,
         centerMode: true,
         centerPadding: '40px',
         slidesToShow: 1
       }
     }]
   });
 });

css: CSS:

body {
  background-color: grey;
}

.slick-center .slide-h3 {
  color: #FFF;
}

.slider {
  width: 600px;
  height: 150px;
  margin: 20px auto;
  text-align: center;
}

.slide-h3 {
  margin: 10% 0 10% 0;
  padding: 40% 20%;
  background: red;
}

.slider div {
  margin-right: 5px;
}

.slick-slide {
  opacity: .6;
  width:10px;
}

.slick-center {
  display: block;
  max-width: 10% !important;
  max-height: 20% !important;
  opacity: 1;
}

someone think that can be possible? 有人认为这可能吗?

Thank you. 谢谢。

It's not changing the color, it's changing the opacity. 它并没有改变颜色,而是改变了不透明度。

Change: 更改:

.slick-center {
  display: block;
  max-width: 10% !important;
  max-height: 20% !important;
  opacity: 1;
}

to: 至:

.slick-center {
  display: block;
  max-width: 10% !important;
  max-height: 20% !important;
  opacity: 0.6; /* keep opacity the same, or just remove this line */
}

Updated fiddle 更新的小提琴

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM