ganlanyuan/tiny-slider

Possible to disable slider if slideCount = slideItems ?

darbymanning opened this issue · 1 comments

I'm using tiny-slider with the responsive option, to display 4 items -- I wondered if it was possible to have the slider disabled if all the items are visible in the viewport?

Not that this is particularly specific to my code, here it is for reference - might help clarify too:

const newsSlider = tns({
    container: sliderContainer,
    mouseDrag: true,
    nav: false,
    gutter: 32,
    "responsive": {
        "0": 1,
        "680": 2,
        "1000": 3,
        "1300": 4
    }
})

So as there are a total of 4 items in the slider, at 1300px or higher, as the slides are all visible I want to disable the slider (ie. so mouseDrag / controls aren't visible etc). I guess ideally, it would be good to extend the responsive feature so that you can also specify other options for each breakpoint, rather than just number of slides).

Hey @darbymanning ,
Thanks for your feedback.

If all the items are visible in the viewport

  • controls and nav are not visible.
  • disable mouseDrag, touch, autoplay and arrowKeys. (added in v1.6.0, v2.0.3)
  • extend the responsive feature. (added in v2.1.0)

The last two will be added in the future.
Done