evgeniyrru/yii2-slick 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

evgeniyrru/yii2-slick

最新稳定版本:1.0.4

Composer 安装命令:

composer require evgeniyrru/yii2-slick

包简介

Yii2 extension for Slick Carousel

README 文档

README

Yii2 extension for jQuery Slick Carousel plugin. See more here: http://kenwheeler.github.io/slick/.

Installation

You can get this extension through Composer. There are two way:

  1. Either run in terminal:
$ php composer.phar require "evgeniyrru/yii2-slick" "*"
  1. Or add:
"evgeniyrru/yii2-slick" : "*"

to the require section of your application's composer.json file. Then run in terminal composer install command:

$ php composer.phar install

Usage

This is a common way to run Yii2 widget.

<?php use evgeniyrru\yii2slick\Slick; use yii\web\JsExpression; ?> Something html here <?=Slick::widget([ // HTML tag for container. Div is default. 'itemContainer' => 'div', // HTML attributes for widget container 'containerOptions' => ['class' => 'container'], // Position for inclusion js-code // see more here: http://www.yiiframework.com/doc-2.0/yii-web-view.html#registerJs()-detail 'jsPosition' => yii\web\View::POS_READY, // It possible to use Slick.js events // see more: http://kenwheeler.github.io/slick/#events 'events' => [ 'edge' => 'function(event, slick, direction) {  console.log(direction);  // left  });' ], // Items for carousel. Empty array not allowed, exception will be throw, if empty  'items' => [ Html::img('/cat_gallery/cat_001.png'), Html::img('/cat_gallery/cat_002.png'), Html::img('/cat_gallery/cat_003.png'), Html::img('/cat_gallery/cat_004.png'), Html::img('/cat_gallery/cat_005.png'), ], // HTML attribute for every carousel item 'itemOptions' => ['class' => 'cat-image'], // settings for js plugin // @see http://kenwheeler.github.io/slick/#settings 'clientOptions' => [ 'autoplay' => true, 'dots' => true, // note, that for params passing function you should use JsExpression object // but pay atention, In slick 1.4, callback methods have been deprecated and replaced with events. 'onAfterChange' => new JsExpression('function() {console.log("The cat has shown")}'), ], ]); ?>

If you want to use breakpoints feature, type something like this:

<?php use evgeniyrru\yii2slick\Slick; use yii\web\JsExpression; <?=Slick::widget([ // Widget configuration. See example above. // settings for js plugin // @see http://kenwheeler.github.io/slick/#settings 'clientOptions' => [ 'dots' => true, 'speed' => 300, 'autoplay' => true, 'infinite' => false, 'slidesToShow' => 4, 'slidesToScroll' => 4, 'responsive' => [ [ 'breakpoint' => 1200, 'settings' => [ 'slidesToShow' => 4, 'slidesToScroll' => 4, 'infinite' => true, 'autoplay' => true, 'dots' => true, ], ], [ 'breakpoint' => 992, 'settings' => [ 'slidesToShow' => 4, 'slidesToScroll' => 4, 'infinite' => true, 'autoplay' => true, 'dots' => true, ], ], [ 'breakpoint' => 768, 'settings' => [ 'slidesToShow' => 2, 'slidesToScroll' => 2, 'infinite' => true, 'autoplay' => true, 'dots' => true, ], ], [ 'breakpoint' => 480, 'settings' => 'unslick', // Destroy carousel, if screen width less than 480px ], ], ], ]); ?> ?>

Issues

If some problems occurred, you can create issue.

Thank you for attention.

统计信息

  • 总下载量: 166.96k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 23
  • 点击次数: 3
  • 依赖项目数: 4
  • 推荐数: 0

GitHub 信息

  • Stars: 22
  • Watchers: 3
  • Forks: 12
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固