Skip to content

Alejka/yii2-fancybox2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fancybox2 Widget for Yii2

Yii2 extension for fancyapps.com/fancybox

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require "alejka/yii2-fancybox2" "*"

or add

"alejka/yii2-fancybox2" : "*"

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

Usage

use alejka\fancybox2\FancyBox;

FancyBox::widget([
    'target' => '.fancybox',
    'options' => [
        'loop' => false,
        'padding' => 0,
        'margin' => [15, 15, 60, 15],
        'afterLoad' => new JsExpression("
            function() {
                var list = $('#links');
                if (!list.length) {    
                    list = $('<ul id=\"links\">');
                    for (var i = 0; i < this.group.length; i++) {
                        $('<li data-index=\"' + i + '\"><label></label></li>').click(function() { $.fancybox.jumpto( $(this).data('index'));}).appendTo( list );
                    }
                    list.appendTo('body');
                }
                list.find('li').removeClass('active').eq( this.index ).addClass('active');
            }
        "),
        'beforeClose' => "function() {
            $('#links').remove();
        }",
    ],
]);

About

Fancybox2 widget for Yii2

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published