iamwebdesigner / yii2-blueimp-gallery
BlueImp Gallery 小部件
0.1.0
2015-10-17 15:14 UTC
Requires
- php: >=5.4.0
- bower-asset/blueimp-gallery: *
- yiisoft/yii2: ~2.0.2
This package is not auto-updated.
Last update: 2024-09-20 06:59:57 UTC
README
Yii 2 小部件,用于与 js BlueImp Gallery 插件一起工作。
关于
该小部件分为两部分
- 小部件渲染器
- 项目列表生成器
可以在不使用渲染组件的情况下使用列表生成器,但请确保通过调用项目组件的 registerAssets
方法并传入 View
类来注册必要的样式和脚本。
安装
安装此软件包的 Composer 命令
composer require iamwebdesigner/yii2-blueimp-gallery
用法
使用项目列表生成器
<?php use iamwebdesigner\blueimp\helpers\YouTube; $items = new YouTube([ 'items' => [ // enter youtube video ids as elements of the array 'ZXsQAXx_ao0', '5-sfG8BV8wU', 'DdGetnDJKCg', ] ])->items;
使用完整的小部件
<?php use iamwebdesigner\blueimp\BlueImpGallery; use iamwebdesigner\blueimp\helpers\Image; echo BlueImpGallery::widget([ 'itemsComponent' => new Image([ 'items' => [ // array of images to use, at key 0 comes image url ['/images/54668', 'title' => 'JavaScript'], ['/images/r46457', 'title' => 'Ruby'], ['/images/t4y5b', 'title' => 'PHP'], ['/images/f5h5eg', 'title' => 'C#'], ] ]), 'clientOptions' => [ // js plugin options 'closeOnEscape' => false ], 'showIndicators' => false, ]); ?>