2017 © Pedro PelĂĄez
 

yii2-extension yii2-fancybox-3

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.

image

newerton/yii2-fancybox-3

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.

  • Friday, April 20, 2018
  • by newerton
  • Repository
  • 2 Watchers
  • 6 Stars
  • 2,555 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 4 Forks
  • 2 Open issues
  • 2 Versions
  • 26 % Grown

The README.md

yii2-fancybox-3

jQuery lightbox script for displaying images, videos and more. Touch enabled, responsive and fully customizable. http://fancyapps.com/fancybox/3/, (*1)

Installation

  • The minimum required PHP version is PHP 5.6 (Concatenation).
  • It works best with PHP 7.

The preferred way to install this extension is through composer., (*2)

Either run, (*3)

php composer.phar require --prefer-dist newerton/yii2-fancybox-3 "*"

or add, (*4)

"newerton/yii2-fancybox-3": "*"

to the require section of your composer.json file., (*5)

Usage

Once the extension is installed, simply use it in your code by :, (*6)

<?php
echo newerton\fancybox3\FancyBox::widget();

Options

 '[data-fancybox]',
    'config' => [
        // Enable infinite gallery navigation
        'loop'              => true,
        
        // Space around image, ignored if zoomed-in or viewport smaller than 800px
        'margin'            => [44,0],
        
        // Horizontal space between slides
        'gutter'            => 30,

        // Enable keyboard navigation
        'keyboard'          => true,

        // Should display navigation arrows at the screen edges
        'arrows'            => true,

        // Should display infobar (counter and arrows at the top)
        'infobar'           => true,
        
        // Should display toolbar (buttons at the top)
        'toolbar'           => true,
        
        // What buttons should appear in the top right corner.
        // Buttons will be created using templates from `btnTpl` option
        // and they will be placed into toolbar (class="fancybox-toolbar"` element)
        'buttons' => [
            'slideShow',
            'fullScreen',
            'thumbs',
            'close'    
        ],

        // Detect "idle" time in seconds
        'idleTime'          => 4,
        
        // Should display buttons at top right corner of the content
        // If 'auto' - they will be created for content having type 'html', 'inline' or 'ajax'
        // Use template from `btnTpl.smallBtn` for customization
        'smallBtn'          => 'auto',
        
        // Disable right-click and use simple image protection for images
        'protect'           => false,
        
        // Shortcut to make content "modal" - disable keyboard navigtion, hide buttons, etc
        'modal'             => false,
        
        'image' => [      
            // Wait for images to load before displaying
            // Requires predefined image dimensions
            // If 'auto' - will zoom in thumbnail if 'width' and 'height' attributes are found
            'preload' => "auto",
        ],
        
        'ajax' => [
            // Object containing settings for ajax request
            'settings' => [
                // This helps to indicate that request comes from the modal
                // Feel free to change naming
                'data' => [
                    'fancybox' => true
                ]
            ]
        ],
        
        'iframe' => [

            // Iframe template
            'tpl'           => '',

            // Preload iframe before displaying it
            // This allows to calculate iframe content width and height
            // (note: Due to "Same Origin Policy", you can't get cross domain data).            'preload'       => true,

            // Custom CSS styling for iframe wrapping element
            'css'           => [],

            // Iframe tag attributes
            'attr'          => [
                'scrolling' => 'auto'
            ]
            
        ],
        
        // Open/close animation type
        // Possible values:
        //   false            - disable
        //   "zoom"           - zoom images from/to thumbnail
        //   "fade"
        //   "zoom-in-out"
        //
        'animationEffect'       => "zoom",

        // Duration in ms for open/close animation
        'animationDuration'     => 366,

        // Should image change opacity while zooming
        // If opacity is 'auto', then opacity will be changed if image and thumbnail have different aspect ratios
        'zoomOpacity'           => 'auto',

        // Transition effect between slides
        //
        // Possible values:
        //   false            - disable
        //   "fade'
        //   "slide'
        //   "circular'
        //   "tube'
        //   "zoom-in-out'
        //   "rotate'
        //
        'transitionEffect'      => "fade",

        // Duration in ms for transition animation
        'transitionDuration'    => 366,

        // Custom CSS class for slide element
        'slideClass'            => '',

        // Custom CSS class for layout
        'baseClass'             => '',

        // Base template for layout
        'baseTpl' => '',

        // Loading indicator template
        'spinnerTpl'        => '
', // Error message template 'errorTpl' => '

The requested content cannot be loaded.
Please try again later., (*7)

, (*8)

', 'btnTpl' => [ 'slideShow' => '', 'fullScreen' => '', 'thumbs' => '', 'close' => '', // This small close button will be appended to your html/inline/ajax content by default, // if "smallBtn" option is not set to false 'smallBtn' => '' ], // Container is injected into this element 'parentEl' => 'body', // Focus handling // ============== // Try to focus on the first focusable element after opening 'autoFocus' => true, // Put focus back to active element after closing 'backFocus' => true, // Do not let user to focus on element outside modal content 'trapFocus' => true, // Module specific options // ======================= 'fullScreen' => [ 'autoStart' => false, ], 'touch' => [ 'vertical' => true, // Allow to drag content vertically 'momentum' => true // Continue movement after releasing mouse/touch when panning ], // Hash value when initializing manually, // set `false` to disable hash change 'hash' => null, // Customize or add new media types // Example: // // media' => { // youtube' => { // params' => { // autoplay' => 0 // } // } // } 'media' => [], 'slideShow' => [ 'autoStart' => false, 'speed' => 4000 ], 'thumbs' => [ 'autoStart' => false, // Display thumbnails on opening 'hideOnClose' => true // Hide thumbnail grid when closing animation starts ], // Callbacks //========== // See Documentation/API/Events for more information // Example: // // afterShow: function( instance, current ) { // console.info( 'Clicked element:' ); // console.info( current.opts.$orig ); // } 'onInit' => new \yii\web\JsExpression('function(){ console.log("onInit"); }'), 'beforeLoad' => new \yii\web\JsExpression('function(){ console.log("beforeLoad"); }'), 'afterLoad' => new \yii\web\JsExpression('function(){ console.log("afterLoad"); }'), 'beforeShow' => new \yii\web\JsExpression('function(){ console.log("beforeShow"); }'), 'afterShow' => new \yii\web\JsExpression('function(){ console.log("afterShow"); }'), 'beforeClose' => new \yii\web\JsExpression('function(){ console.log("beforeClose"); }'), 'afterClose' => new \yii\web\JsExpression('function(){ console.log("afterClose"); }'), 'onActivate' => new \yii\web\JsExpression('function(){ console.log("onActivate"); }'), 'onDeactivate' => new \yii\web\JsExpression('function(){ console.log("onDeactivate"); }'), // Interaction // =========== // Use options below to customize taken action when user clicks or double clicks on the fancyBox area, // each option can be string or method that returns value. // // Possible values: // "close" - close instance // "next" - move to next gallery item // "nextOrClose" - move to next gallery item or close if gallery has only one item // "toggleControls" - show/hide controls // "zoom" - zoom image (if loaded) // false - do nothing // Clicked on the content 'clickContent' => new \yii\web\JsExpression('function( current, event ) { return current.type === "image" ? "zoom" : false; }'), // Clicked on the slide 'clickSlide' => 'close', // Clicked on the background (backdrop) element 'clickOutside' => 'close', // Same as previous two, but for double click 'dblclickContent' => false, 'dblclickSlide' => false, 'dblclickOutside' => false, // Custom options when mobile device is detected // ============================================= 'mobile' => [ 'clickContent' => new \yii\web\JsExpression('function( current, event ) { return current.type === "image" ? "toggleControls" : false; }'), 'clickSlide' => new \yii\web\JsExpression('function( current, event ) { return current.type === "image" ? "toggleControls" : "close"; }'), 'dblclickContent' => new \yii\web\JsExpression('function( current, event ) { return current.type === "image" ? "zoom" : "close"; }'), 'dblclickSlide' => new \yii\web\JsExpression('function( current, event ) { return current.type === "image" ? "zoom" : "close"; }'), ], // Internationalization // ============ 'lang' => 'en', 'i18n' => [ 'en' => [ 'CLOSE' => 'Close', 'NEXT' => 'Next', 'PREV' => 'Previous', 'ERROR' => 'The requested content cannot be loaded.
Please try again later.', 'PLAY_START' => 'Start slideshow', 'PLAY_STOP' => 'Pause slideshow', 'FULL_SCREEN' => 'Full screen', 'THUMBS' => 'Thumbnails' ], 'de' => [ 'CLOSE' => 'Schliessen', 'NEXT' => 'Weiter', 'PREV' => 'ZurĂŒck', 'ERROR' => 'Die angeforderten Daten konnten nicht geladen werden.
Bitte versuchen Sie es spÀter nochmal.', 'PLAY_START' => 'Diaschau starten', 'PLAY_STOP' => 'Diaschau beenden', 'FULL_SCREEN' => 'Vollbild', 'THUMBS' => 'Vorschaubilder' ] ] ] ]); echo yii\helpers\Html::a(yii\helpers\Html::img('/folder/thumb.jpg'), '/folder/imagem.jpg', ['data-fancybox' => true]); ?>

The Versions

20/04 2018

dev-master

9999999-dev

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.

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 fancybox fancyapps fancybox3

22/08 2017

dev-dev

dev-dev

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.

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 fancybox fancyapps fancybox3