Slick: Add a refresh method

Created on 23 Sep 2014  路  11Comments  路  Source: kenwheeler/slick

Currently you can manually refresh slick using slickSetOption(anyoption, anyvalue, true);

Any chance of a slickRefresh method rather than using slickSetOption(null, null, true); would make code clear to developers inheriting a project that are less familiar with slick.

Feature Request

Most helpful comment

$('.slick-slider').slick('refresh'); worked for me. (Ver. "slick-carousel": "^1.6.0")

All 11 comments

+1

Funny story. You can actually do this right on the domNode. Every domNode that has been slicked has its instance of slick right on it. For example:

$('.my-slider')[0].slick.refresh()

I think folks would appreciate it if you would add that to the documentation in the README file.

@compwright I concur

I also concur - took me ages to find this. Great carousel btw!

Thank god we found this. Google is awesome, but would be better if this was in the documentation. +1

Would be awesome if $('.your-element').slick('refresh'); was supported.

Seems like this works anyway. :)

This does not seem to work?
I tried:
jQuery(ele).slick('refresh')
and
jQuery(ele).slick.refresh()

Does not seem like slick object has a refresh function?

$('.slick-slider').slick('refresh'); worked for me. (Ver. "slick-carousel": "^1.6.0")

@gbrits Uncaught TypeError: Cannot read property 'refresh' of undefined
slick 1.8.1, after load new html from ajax

Was this page helpful?
0 / 5 - 0 ratings