ramzyvirani/yii2-lightbox

Lightbox widget for Yii2

Installs: 398

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 14

Type:yii2-extension

1.1 2015-10-19 09:36 UTC

This package is auto-updated.

Last update: 2024-04-29 03:01:53 UTC


README

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist ramzyvirani/yii2-lightbox "*"

or add

"ramzyvirani/yii2-lightbox": "*"

to the require section of your composer.json.

Usage

Once the extension is installed, simply add widget to your page as follows:

echo Lightbox::widget([
    'files' => [
        [
            'thumb' => 'url/to/thumb.ext',
            'original' => 'url/to/original.ext',
            'title' => 'optional title',
        ],
    ]
]);

To add html options you can use below syntax

echo Lightbox::widget([
    'files' => [
        [
            'thumb' => [
                'src'=>'url/to/thumb.ext',
                'htmlOptions' => ['class'=>'col-md-12', 'alt'=>'Alternate Text'] // These options will be applied to Image tag.
            ],
            'original' => [
                'src' => 'url/to/original.ext',
            ]
            'title' => 'optional title',
        ],
    ]
]);