slavkovrn / yii2-imagecarousel
Yii2 扩展使用 jQuery jquery.carousel-1.1.min.js,并从定义的结构 PHP 数组中创建图片轮播。
v1.0.0
2018-01-07 05:59 UTC
Requires
- yiisoft/yii2: *
This package is auto-updated.
Last update: 2024-09-12 04:36:10 UTC
README
Yii2 扩展使用 jQuery jquery.carousel-1.1.min.js,并从定义的结构 PHP 数组中创建图片轮播。
安装
安装此扩展的首选方式是通过 composer。
运行以下命令之一
composer require slavkovrn/yii2-imagecarousel
或
"slavkovrn/yii2-imagecarousel": "*"
将以下内容添加到您的 composer.json
文件的 require 部分。
使用方法
在您的视图中设置扩展链接
<?php use slavkovrn\imagecarousel\ImageCarouselWidget; ?> <?= ImageCarouselWidget::widget([ 'id' =>'image-carousel', // unique id of widget 'width' => 960, // width of widget container 'height' => 300, // height of widget container 'img_width' => 320, // width of central image 'img_height' => 180, // height of central image 'images' => [ // images of carousel [ 'src' => 'http://yii2.kadastrcard.ru/uploads/prettyphoto/image1.jpg', 'alt' => 'Image 1', ], [ 'src' => 'http://yii2.kadastrcard.ru/uploads/prettyphoto/image2.jpg', 'alt' => 'image 2', ], [ 'src' => 'http://yii2.kadastrcard.ru/uploads/prettyphoto/image3.jpg', 'alt' => 'image 3', ], [ 'src' => 'http://yii2.kadastrcard.ru/uploads/prettyphoto/image4.jpg', 'alt' => 'image 4', ], ] ]) ?>