tyrann0us / slick-slider

Turn your native WordPress galleries into beautiful sliders using the awesome “slick” slider.
https://wordpress.org/plugins/slick-slider/
GNU General Public License v2.0
4 stars 4 forks source link

Add responsive support #4

Open tyrann0us opened 8 years ago

tyrann0us commented 8 years ago

Use Underscore templates for HTML rendering?

michakrapp commented 7 years ago

Would be cool to see a solution for this. Really like your plugin and the idea of using the standard gallery.

Asked in the wp.org forum for a current solution (or tip) for this :) wp.org plugin forum

tyrann0us commented 7 years ago

Having responsive options adjustable using the UI is in the works, but unfortunately without ETA.

I posted a possible workaround in the thread, pasted here for completeness:

The easiest way to accomplish this is to use slick’s slickSetOption method. Enqueue a JS file which uses slick-slider-core as $deps:

jQuery( document ).ready( function() {
    jQuery( '.slick-slider-wrapper .slick-slider' ).slick( 'setOption', 'responsive', [
        {
            breakpoint: 480,
            settings: {
                slidesToShow: 1,
            }
        },
        {
            breakpoint: 768,
            settings: {
                slidesToShow: 2,
            }
        },
        {
            breakpoint: 992,
            settings: {
                slidesToShow: 4,
            }
        },
    ],
    true
    )
} )

Adjust the selector, breakpoints and settings to your specific needs.