How to use Slick (methor)

Tram Ho

Hi guys today I’m going to write the rest about slick. These are the methors (methods) that help frondend programmers to have more control as well as control how slick works. In the previous post, I wrote about events that happen with slick but have not yet impacted the way slick works, methor will help us with that.

1. slick

Slick initialization method Example:

We will pass the properties we want to config from the beginning

2. slick

This method cancels slick config. Return items without a slide Example:

Before

After

3. slickNext

The method helps us navigate the next and prev buttons without using the slick default button. For example:


In addition to next by default button we can also assign the next event to another button. This serves very well for designing slides as you like

4. slickPrev

This method is similar to the slickNext method, for example:

5. slickPause, slickPlay

When slick in autoplaySpeed slide state will run continuously if you want to stop this state, we use slickPause method For example:

slickPlay will cancel the slickPause command

5. slickGoTo

slickGoTo will show the item location we want to show. For example:

6. slickCienSlide

Returns the current slide position Example:

7. slickAdd

Add a slide. If we add a location to it, it will add at that position. If no index is provided.
Specifically, the parameters passed as follows:

element : the element to be added.
index : the position of the element to be added.
addBefore : add before or after the selected position.
For example:

8. slickRemove

Delete slides by position, the parameters passed similar to slickAdd

For example:

9. slickFilter

Filtering the elements in the slide, this method is also quite good. Specific parameters are as follows:

Where filter is a funtion: For example:

In this example it will filter for even-position elements. We can add filters by other conditions ( https://stackoverflow.com/questions/47714202/slick-slider-filter-by-class-issue ) like:

Well, it is quite a lot and useful then I hope all of my slick articles will help you to control the slide when desige. Good luck

Share the news now

Source : Viblo