简体   繁体   English

光滑的滑块响应断点在 576 像素下不起作用

[英]Slick slider Responsive breakpoints not working at 576px

I have implemented a slick slider which works fine in 1200px, but as soon I resize, it breaks down.我已经实现了一个在 1200 像素下可以正常工作的光滑滑块,但是一旦我调整大小,它就会崩溃。 I need to implement 3 slides in 1200px, 2 slides in 786px and 1 slide in 576px screen with equal space between each slide.我需要在 1200px 中实现 3 张幻灯片,在 786px 中实现 2 张幻灯片,在 576px 屏幕中实现 1 张幻灯片,每张幻灯片之间的间距相等。 When I tried to put a margin between each slide, the first slide, cuts off.当我试图在每张幻灯片之间放置边距时,第一张幻灯片被切断了。 Here is my code.这是我的代码。

  • JQUERY查询
jQuery('.multiple-items').slick({
        prevArrow: '<button class="image-prev w-30 w-md-40 w-lg-50 h-25 h-lg-50 h-md-40 border-0 bg-bfp-primary position-absolute rotate180"></button>',
        nextArrow: '<button class="image-next w-30 w-md-40 w-lg-50 h-25 h-lg-50 h-md-40 border-0 bg-bfp-primary position-absolute "></button>',
        dots: false,
        infinite: true,
        slidesToShow: 3,
        slidesToScroll: 3,
        responsive: [
        {
            breakpoint: 1200,
            settings: {
                slidesToShow: 3,
                slidesToScroll: 3,
                infinite: true,
                dots: false,
                mobileFirst: true,
            }
        },
        {
            breakpoint: 768,
            settings: {
                slidesToShow: 3,
                slidesToScroll: 3,
                mobileFirst: true,
            }
        },
        {
            breakpoint: 576,
            settings: {
                slidesToShow: 2,
                slidesToScroll: 1,
                mobileFirst: true,
            }
        }

    ]

});
jQuery('.slick-list').find('.slick-active').addClass('slick-slide-margin');
  • PHP PHP
<div class="ml-7 ml-xl-24 mr-0">
    <div class="pt-6.8 pb-9">
        <h2 class="font-inter-medium fz-20 text-theme-blue-dark leading-24">Photo Gallery</h2>
            <div class="multiple-items pt-4" >
                <?php 
                while ($photo_gallery_query->have_posts()) : $photo_gallery_query->the_post();
                        $featured_image_url = get_the_post_thumbnail_url(get_the_ID(),'full');?>
                    <div>
                        <img src="<?php echo $featured_image_url; ?>">
                    </div>
                <?php endwhile; 
                wp_reset_postdata();?>
            </div>
    </div>
</div>
  • SASS SASS
.slick-slide-margin {
    @extend .w-270;
    @extend .mr-xl-7;
    @extend .mr-3;
}

Hi @Kuldeep Upreti and welcome to Stackoverflow.嗨@Kuldeep Upreti,欢迎来到 Stackoverflow。

Just to make sure, have you tried to compare your solution to their demos?只是为了确定一下,您是否尝试将您的解决方案与他们的演示进行比较?

http://kenwheeler.github.io/slick/ http://kenwheeler.github.io/slick/

Also this thread might be helpful,这个线程也可能有帮助,

Slick slider not being responsive when resizing the window 调整窗口大小时,光滑的滑块没有响应

Often, the kind of problem you describe, is pretty easy to solve once you figure it out.通常,您描述的那种问题,一旦弄清楚就很容易解决。 Most of the times it's just a minor fix, like a missing configuration, event and so on.大多数情况下,这只是一个小问题,比如缺少配置、事件等。

To make it easier to help, you can also set up a demo using a service like CodePen (or any other similar service),为了更容易提供帮助,您还可以使用 CodePen 等服务(或任何其他类似服务)设置演示,

https://codepen.io/ https://codepen.io/

Let us know if you're not being able to solve your problem with these links.如果您无法通过这些链接解决问题,请告诉我们。 :-) :-)

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

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