wcj343169893 / yii2-lightgallery
widget lightgallery
v2.0.1
2024-05-14 08:50 UTC
Requires
- npm-asset/lightgallery: *
- yiisoft/yii2: *
README
描述
此Widget基于LightGallery,用于Yii2框架。请参阅完整的文档
安装
安装此扩展的首选方式是通过 composer。
运行以下命令
composer require wcj343169893/yii2-lightgallery
或者将以下内容添加到您的 composer.json
文件的 require 部分
"wcj343169893/yii2-lightgallery": "*"
to require section of your composer.json
file.
使用方法
扩展安装后,只需在代码中使用它即可
<?php echo \wcj343169893\lightgallery\LightGallery::widget([ 'items' => [ [ 'thumb' => '../thumb/image_1.jpg', 'src' => '../big/image_1.jpg', 'caption' => '<h4> caption </h4><p> ... </p>', 'imgOptions' => [ 'width' => '100%', 'alt' => 'description' ] ], [ 'thumb' => '../thumb/image_2.jpg', 'src' => '../big/image_2.jpg' ] ], // more plugins: 'plugins' => ['lgZoom', 'lgThumbnail'] ]); ?>
要添加插件,只需将其名称添加到 plugins 选项 plugins =>['lgZoom']
,请参阅完整列表。对于其他 LightGallery 选项,请使用 pluginOptions,请参阅文档。
此项目受 LGPL V3.0 许可证保护。