andrew72ru/yii2-featherlight

noelboss/featherlight for yii-2

安装: 103

依赖: 0

建议: 0

安全性: 0

星星: 1

关注者: 1

分支: 0

开放问题: 0

语言:JavaScript

类型:yii2-extension

1.0 2015-07-23 05:10 UTC

This package is auto-updated.

Last update: 2024-09-23 01:43:46 UTC


README

noelboss/featherlight for yii-2

安装

安装此扩展的首选方式是通过 composer

运行以下命令之一

php composer.phar require --prefer-dist andrew72ru/yii2-featherlight "*"

"andrew72ru/yii2-featherlight": "*"

将以下内容添加到您的 composer.json 文件的 require 部分。

有关基本用法,请参阅 noelboss/featherlight 文档。

Lightbox 使用

<?= \andrew72ru\featherlight\FeatherLight::widget([
    'src' => Url::to(['small-image']), // Small image
    'url' => Url::to(['large-image']), // Large image
    'imageOptions' => ['class' => 'img-thumbnail'] // Image html options
]); ?>

画廊使用

<?php
$items = [
    [
        'src' => Url::to(['small-image-0']), // Small image
        'url' => Url::to(['large-image-0']), // Large image
    ],
    [
        'src' => Url::to(['small-image-1']), // Small image
        'url' => Url::to(['large-image-1']), // Large image
    ],
    [
        'src' => Url::to(['small-image-2']), // Small image
        'url' => Url::to(['large-image-2']), // Large image
    ],
    [
        'src' => Url::to(['small-image-3']), // Small image
        'url' => Url::to(['large-image-3']), // Large image
    ],
];

echo FeatherlightGallery::widget([
    'items' => $items, 
    'previewOptions' => ['class' => 'img-thumbnail'], // Small image html options
    'sectionOptions' => ['style' => 'display: block'] // Section html options
]);
?>

在画廊使用中,请记住大图 URL 以 .jpg.png 或类似格式结尾。

这是正确的 URL

http://mysite.org/image?w=1024&h=1024&file=image-0.jpg

而这是错误的

http://mysite.org/image?file=image-0.jpg&w=1024&h=1024