loveorigami / yii2-colorbox
此小部件是用于jQuery插件Colorbox的包装器
dev-master
2018-03-16 12:58 UTC
Requires
- bower-asset/jquery-colorbox: *
This package is auto-updated.
Last update: 2024-09-21 20:36:08 UTC
README
基于Colorbox的适用于Yii2的可自定义轻量级jQuery插件。
安装
安装此扩展的首选方式是通过composer。
运行以下命令:
php composer.phar require "loveorigami/yii2-colorbox" "*"
或者将以下内容添加到您的应用程序的composer.json
文件的require部分:
"loveorigami/yii2-colorbox" : "*"
到
使用方法
- 在视图中
use lo\widgets\colorbox\Colorbox; <?= Colorbox::widget([ 'selector' => '.colorbox', 'clientOptions' => [ 'maxWidth' => 800, 'maxHeight' => 600, ], 'coreStyle' => 2 ]) ?>
在Iframe中
- 在表单中(父视图)
use lo\widgets\colorbox\Colorbox; echo Colorbox::widget([ 'coreStyle' => 3, 'reload' => true, 'selector' => '.iframe-page', 'clientOptions' => [ 'width' => '95%', 'height' => '95%', 'iframe' => true, 'fixed' => true, ], ])
<form> ... <a class="iframe-page" href="/site.com/admin/module/controller/update?id=1" title="edit child item" tabindex="-1"><i class="fa fa-pencil"></i> Edit child item</a> ... </form>
- 在Iframe中(子视图)
use lo\widgets\colorbox\Colorbox; echo Colorbox::widget([ 'iframeTarget' => '.form-save, .form-cancel' ]);
<form> ... <button type="submit" class="btn btn-success form-save">Save</button> <button type="button" class="btn btn-default form-cancel">Cancel</button> ... </form>