首页 > 解决方案 > 如何从 Slick Slider 中删除类?

问题描述

我一直在尝试使用光滑的滑块,但遇到了一个小问题。我有两个部分要使用滑块。第一个只是一张图片的“淡入淡出”效果,第二个是推荐滑块。现在的问题是,如果我想在我的推荐信之间留出一点余地,我会使用:

 .slick-slide {
  margin: 0px 10px;
  }

见推荐书之间的边距图片

HTML 标记 -

    <div class="slider">
    <div class="testimonial-container">
        <div class="testimonial-img">
            <img src="images/face.jpg" alt="face">
        </div>
        <div class="testimonial-text">
            <h3>This is the only Norskkurs to take in Stavanger if value for 
                money and truly progressing with
                the Norwegian are important factors for you.
            </h3>
            <strong>Jessica Morris</strong>
            <p>A1/A2 Student</p>
        </div>
    </div>
    <div class="testimonial-container">
        <div class="testimonial-img">
            <img src="images/face.jpg" alt="face">
        </div>
        <div class="testimonial-text">
            <h3>Very hands on and animated. Relaxed atmosphere which is
                perfect for feeling comfortable in a new language setting.
            </h3>
            <strong>Helen Brian</strong>
            <p>A2 Student</p>
        </div>
    </div>
    <div class="testimonial-container">
        <div class="testimonial-img">
            <img src="images/face.jpg" alt="face">
        </div>
        <div class="testimonial-text">
            <h3>This course is a wonderful journey with lots of fun and 
                activities towards the goal. It's a well
                designed course for learning.
            </h3>
            <strong>Chidabaram Harikumar</strong>
            <p>A1/A2/B1 Student</p>
        </div>
    </div>
    <div class="testimonial-container">
        <div class="testimonial-img">
            <img src="images/face.jpg" alt="face">
        </div>
        <div class="testimonial-text">
            <h3>It is first language course which I have lasted more than one month :) . It means alot to me. They
                teach with both their heart and brain.
            </h3>
            <strong>Amir Ghaderian</strong>
            <p>A2/B1 Student</p>
        </div>
    </div>
    <div class="testimonial-container">
        <div class="testimonial-img">
            <img src="images/face.jpg" alt="face">
        </div>
        <div class="testimonial-text">
            <h3>One of the best thing which I have done in my life is to join Norskkurs in LNS.It's a great place to
                learn the language with good people.

            </h3>
            <strong>Dayanand Mohanasundram</strong>
            <p>A1/A2 Student</p>
        </div>
    </div>
</div>

现在我的下一张“淡入淡出”幻灯片我不想要边距,但它仍然会为我使用的所有幻灯片添加相同的 .slick-slide 属性。

无论如何我只能将其应用于一张幻灯片或从其他幻灯片中删除此类/属性吗?

简而言之,我只需要推荐幻灯片之间的边距,而不需要另一张。我怎样才能解决这个问题?

标签: javascriptjqueryhtmlcssslick.js

解决方案


您可以将类推荐添加到推荐滑块并为此类添加边距。

  .testimonial-slide {
  margin: 0px 10px;
  }

推荐阅读