javascript - 如何从 Slick Slider 中删除类?

标签 javascript jquery html css slick.js

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

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

See picture of margin between the testimonials

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 属性。

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

简而言之,我只需要推荐幻灯片与另一张幻灯片之间的空白。我该如何解决这个问题?

最佳答案

您可以将类(class)推荐添加到推荐 slider ,并为该类(class)添加边距。

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

关于javascript - 如何从 Slick Slider 中删除类?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58608609/

相关文章:

javascript - 通过从 html 对象 ID(例如按钮 ID)传递变量来合并 javascript 函数

javascript - 使图像在较小的显示器上不以全分辨率加载

PHP 中的 Javascript 蓝调 : getElementById & getElementsByClassName

javascript - 错误 : ckeditor-duplicated-modules: Some CKEditor 5 modules are duplicated

jquery - ScrollTop() 不工作

c# - 将 Razor C# 与 javascript 结合使用

jQuery 航路点延迟

javascript - D3.js 理解渐变填充

php - jQuery 的问题

javascript - Angular js中从html页面http.get()数据传递参数的语法错误