Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Using jQuery Plugins Using a jQuery Carousel The Carousel Challenge Solution

Max Weir
Max Weir
14,963 Points

responsive slick

In the slick documentation it mentions a new feature that at a given break point you can disable slick: // You can unslick at a given breakpoint now by adding: // settings: "unslick" // instead of a settings object

But I tried this and it doesnt work, maybe I've done it wrong but I used:

{ breakpoint: 1024, settings: "unslick" }, { breakpoint: 600, settings: { slidesToShow: 3, slidesToScroll: 3 } }

Is that how it should be done?

2 Answers

Lewis Cowles
Lewis Cowles
74,902 Points

Check the Slick documentation and use CTRL+F

Here is what I found, and to me it makes more sense

$('.responsive').slick({
  dots: true,
  infinite: false,
  speed: 300,
  slidesToShow: 4,
  slidesToScroll: 4,
  responsive: [
    {
      breakpoint: 1024,
      settings: "unslick"
    },
    {
      breakpoint: 600,
      settings: {
        slidesToShow: 2,
        slidesToScroll: 2
      }
    },
    {
      breakpoint: 480,
      settings: {
        slidesToShow: 1,
        slidesToScroll: 1
      }
    }
    // You can unslick at a given breakpoint now by adding:
    // settings: "unslick"
    // instead of a settings object
  ]
});

so basically in the settings, there is a key with a value "responsive", which is a JS array literal; containing one object literal per breakpoint.

Max Weir
Max Weir
14,963 Points

thanks for your reply, so at the 1024 breakpoint if I wanted to remove slick what would the settings read?

Lewis Cowles
Lewis Cowles
74,902 Points

I do think at this stage Max you are just being lazy, I have let you know that on the slick docs you should use CTRL+F if you don't have time to fully read, and read what is there.

Check the Slick documentation and use CTRL+F

I have updated the code example to remove slick at 1024 breakpoint, but really the slick documentation has all this in it, so please at least read it, and use code from their examples (which is all the above is).

Max Weir
Max Weir
14,963 Points

Well I never thought you would suddenly call me lazy, I have read the docs AND even searched through all the comments and EVEN searched online for a solution before I posted my question to the forum, none seemed to answer the question and I had already tried what you had also.

After further testing I found that the breakpoints are set to a max-width and from there I was able to work out a hack to unslick it from 1024 upwards which was a work around to my problem.

Don't want to waste any more of your time - case closed.

Lewis Cowles
Lewis Cowles
74,902 Points

Max, you cannot have read the docs, and I did not call you lazy, I said you were being lazy, there is a difference. It is simply impossible for you to have read the docs, and not seen the very code I posted in my answer. It's a copy and paste answer from the docs!

https://jsfiddle.net/LewisCowles1986/y83ehd1k/embedded/result/

It's not that you are wasting anyone's time, either, a larger problem than time-wasting, is that you seem unwilling to learn an alternative method of reviewing information, to what is clearly not working for you.

I am glad whatever you have done has resolved your issues with slick, but chill out, have a great weekend, and try to RTFM, use tools such as CTRL+F to skim