Skip to content

bajhoe/yii2-widget-lightbox2

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lightbox2 widget for Yii2

Forked from Coderius. Forking reason: neutralize script and fixing minor bugs. The Lightbox2 widget is a customized lightbox script based on Lightbox. and This widget used to overlay images on top of the current page.

alt text

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require bajhoe/yii2-widget-lightbox2 "*"

or add

"bajhoe/yii2-widget-lightbox2" : "*"

to the require section of your application's composer.json file.

Usage

  • In view:
use coderius\lightbox2\Lightbox2;

<?= coderius\lightbox2\Lightbox2::widget([
    'clientOptions' => [
        'resizeDuration' => 200,
        'wrapAround' => true,
        
    ]
]); ?>

<a href="<?= Yii::getAlias("@img-web-blog-posts/1/middle/pic.jpg"); ?>" data-lightbox="roadtrip" data-title="some title" data-alt="some alt">
    <!-- Thumbnail picture -->
    <?= Html::img("@img-web-blog-posts/pic.jpg"); ?>
</a>

<a href="<?= Yii::getAlias("@img-web-blog-posts/10/middle/pic2.jpg"); ?>" data-lightbox="roadtrip">
    <!-- Thumbnail picture -->
    <?= Html::img("@img-web-blog-posts/pic2.jpg"); ?>
</a>

<a href="<?= Yii::getAlias("@img-web-blog-posts/11/middle/pic3.jpg"); ?>" data-lightbox="roadtrip">
    <!-- Thumbnail picture -->
    <?= Html::img("@img-web-blog-posts/pic3.jpg"); ?>
</a>

You need set data-lightbox attribute to link and path to image in href attribute. If you wanna to set group images, then put identic names to data-lightbox attribute for each needed link.

*Thumbnail picture, by clicking on which opens the widget is wrapped with a link

Reference to plugin github repository that is used in this widget.

About

The Yii2 Lightbox2 widget is a customized lightbox script.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%