newerton/yii2-fancybox

fancyBox is a tool that offers a nice and elegant way to add zooming functionality for images, html content and multi-media on your webpages.

Installs: 120 917

Dependents: 11

Suggesters: 0

Security: 0

Stars: 39

Watchers: 6

Forks: 32

Open Issues: 1

Language:JavaScript

Type:yii2-extension

v1.0.0 2021-02-15 17:03 UTC

This package is auto-updated.

Last update: 2024-11-16 02:01:27 UTC


README

fancyBox is a tool that offers a nice and elegant way to add zooming functionality for images, html content and multi-media on your webpages. http://fancyapps.com/fancybox/

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require newerton/yii2-fancybox

or add

"newerton/yii2-fancybox": "^1.0"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by :

<?php
echo newerton\fancybox\FancyBox::widget([
    'target' => 'a[rel=fancybox]',
    'helpers' => true,
    'mouse' => true,
    'config' => [
        'maxWidth' => '90%',
        'maxHeight' => '90%',
        'playSpeed' => 7000,
        'padding' => 0,
        'fitToView' => false,
        'width' => '70%',
        'height' => '70%',
        'autoSize' => false,
        'closeClick' => false,
        'openEffect' => 'elastic',
        'closeEffect' => 'elastic',
        'prevEffect' => 'elastic',
        'nextEffect' => 'elastic',
        'closeBtn' => false,
        'openOpacity' => true,
        'helpers' => [
            'title' => ['type' => 'float'],
            'buttons' => [],
            'thumbs' => ['width' => 68, 'height' => 50],
            'overlay' => [
                'css' => [
                    'background' => 'rgba(0, 0, 0, 0.8)'
                ]
            ]
        ],
    ]
]);

echo Html::a(Html::img('/folder/thumb.jpg'), '/folder/imagem.jpg', ['rel' => 'fancybox']);
?>

Hint: Do not forget to declare the Html class at the top of the file.

use yii\helpers\Html;