panix/wgt-slick

Widget Slick

Installs: 55

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:pixelion-widget

dev-master 2021-02-01 10:57 UTC

This package is auto-updated.

Last update: 2024-10-29 05:59:26 UTC


README

The Slick is a Yii2 wrapper for the [Slick] (https://kenwheeler.github.io/slick/)

Latest Stable Version Total Downloads

Installation

The preferred way to install this extension is through composer.

Either run

php composer require --prefer-dist panix/wgt-slick "*"

or add

"panix/wgt-slick": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by :

<?php
use panix\ext\slick\SlickWidget;

SlickWidget::begin([
    'containerTag' => 'div',
    'containerOptions' => [
        'class' => 'container-class'
    ],
    'options' => [
        'dots' => true,
        'infinite' => false,
        'slidesToShow' => 4,
        'slidesToScroll' => 4,
        'responsive' => [
            [
                'breakpoint' => 1024,
                'settings' => [
                    'slidesToShow' => 3,
                    'slidesToScroll' => 3,
                    'infinite' => true,
                    'dots' => true
                ]
            ],
            [
                'breakpoint' => 600,
                'settings' => [
                    'slidesToShow' => 2,
                    'slidesToScroll' => 2
                ]
            ],
            [
                'breakpoint' => 480,
                'settings' => [
                    'slidesToShow' => 1,
                    'slidesToScroll' => 1
                ]
            ]
        ]
    ]
]);
?>

<div class="item-class"><img src="/img/1.jpg" alt="Image 1"></div>
<div class="item-class"><img src="/img/2.jpg" alt="Image 2"></div>
<div class="item-class"><img src="/img/3.jpg" alt="Image 3"></div>
<div class="item-class"><img src="/img/4.jpg" alt="Image 4"></div>


<?php SlickWidget::end(); ?>