// ==================================================
// fancyBox v3.0.39
//
// Licensed GPLv3 for open source use
// or fancyBox Commercial License for commercial use
//
// http://fancyapps.com/fancybox/
// Copyright 2017 fancyApps
//
// ==================================================
;(function (window, document, $, undefined) {
'use strict';
// If there's no jQuery, fancyBox can't work
// =========================================
if ( !$ ) {
return undefined;
}
// Private default settings
// ========================
var defaults = {
// Animation duration in ms
speed : 330,
// Enable infinite gallery navigation
loop : true,
// Should zoom animation change opacity, too
// If opacity is 'auto', then fade-out if image and thumbnail have different aspect ratios
opacity : 'auto',
// Space around image, ignored if zoomed-in or viewport smaller than 800px
margin : [44, 0],
// Horizontal space between slides
gutter : 30,
// Should display toolbars
infobar : true,
buttons : true,
// What buttons should appear in the toolbar
slideShow : true,
fullScreen : true,
thumbs : true,
closeBtn : true,
// Should apply small close button at top right corner of the content
// If 'auto' - will be set for content having type 'html', 'inline' or 'ajax'
smallBtn : 'auto',
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",
// Protect an image from downloading by right-click
protect : false
},
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,
// Scrolling attribute for iframe tag
scrolling : 'no',
// Custom CSS styling for iframe wrapping element
css : {}
},
// Custom CSS class for layout
baseClass : '',
// Custom CSS class for slide element
slideClass : '',
// Base template for layout
baseTpl : '
The requested content cannot be loaded. Please try again later.
',
// This will be appended to html content, if "smallBtn" option is not set to false
closeTpl : '',
// Container is injected into this element
parentEl : 'body',
// Enable gestures (tap, zoom, pan and pinch)
touch : true,
// Enable keyboard navigation
keyboard : true,
// Try to focus on first focusable element after opening
focus : true,
// Close when clicked outside of the content
closeClickOutside : true,
// Callbacks
beforeLoad : $.noop,
afterLoad : $.noop,
beforeMove : $.noop,
afterMove : $.noop,
onComplete : $.noop,
onInit : $.noop,
beforeClose : $.noop,
afterClose : $.noop,
onActivate : $.noop,
onDeactivate : $.noop
};
var $W = $(window);
var $D = $(document);
var called = 0;
// Check if an object is a jQuery object and not a native JavaScript object
// ========================================================================
var isQuery = function (obj) {
return obj && obj.hasOwnProperty && obj instanceof $;
};
// Handle multiple browsers for requestAnimationFrame()
// ====================================================
var requestAFrame = (function() {
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
function( callback ) {
window.setTimeout(callback, 1000 / 60); };
})();
// Check if element is inside the viewport by at least 1 pixel
// ===========================================================
var isElementInViewport = function( el ) {
var rect;
if ( typeof $ === "function" && el instanceof $ ) {
el = el[0];
}
rect = el.getBoundingClientRect();
return rect.bottom > 0 &&
rect.right > 0 &&
rect.left < (window.innerWidth || document.documentElement.clientWidth) &&
rect.top < (window.innerHeight || document.documentElement.clientHeight);
};
// Class definition
// ================
var FancyBox = function( content, opts, index ) {
var self = this;
self.opts = $.extend( true, { index : index }, defaults, opts || {} );
self.id = self.opts.id || ++called;
self.group = [];
self.currIndex = parseInt( self.opts.index, 10 ) || 0;
self.prevIndex = null;
self.prevPos = null;
self.currPos = 0;
self.firstRun = null;
// Create group elements from original item collection
self.createGroup( content );
if ( !self.group.length ) {
return;
}
// Save last active element and current scroll position
self.$lastFocus = $(document.activeElement).blur();
// Collection of gallery objects
self.slides = {};
self.init( content );
};
$.extend(FancyBox.prototype, {
// Create DOM structure
// ====================
init : function() {
var self = this;
var testWidth;
var $container;
self.scrollTop = $W.scrollTop();
self.scrollLeft = $W.scrollLeft();
// Disable compensating on touch-enabled devices as they probably do not have scrollbars anyway
// and therefore we avoid of unnecessary layout reflow
if ( !$.fancybox.isTouch && !$( 'html' ).hasClass( 'fancybox-enabled' ) ) {
testWidth = $( 'body' ).width();
$( 'html' ).addClass( 'fancybox-enabled' );
testWidth = $( 'body' ).width() - testWidth;
// Body width has increased - compensate missing scrollbars
if ( testWidth > 1 ) {
$( '