(function (window, document, $, undefined) { 'use strict'; if ( !$ ) { return undefined; } var defaults = { speed : 330, loop : true, opacity : 'auto', margin : [44, 0], gutter : 30, infobar : true, buttons : true, slideShow : true, fullScreen : true, thumbs : true, closeBtn : true, smallBtn : 'auto', image : { preload : "auto", protect : false }, // Custom CSS class for layout baseClass : '', // Custom CSS class for slide element slideClass : '', // Base template for layout baseTpl : '', // Loading indicator template spinnerTpl : '
', // Error message template errorTpl : '

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 galleryHasHtml = false; var testWidth; var $container; self.scrollTop = $D.scrollTop(); self.scrollLeft = $D.scrollLeft(); if ( !$.apgfancybox.getInstance() ) { testWidth = $( 'body' ).width(); $( 'html' ).addClass( 'apgfancybox-enabled' ); if ( $.apgfancybox.isTouch ) { if ( galleryHasHtml ) { $('body').css({ position : 'fixed', width : testWidth, top : self.scrollTop * -1 }); } } else { // Compare page width after adding "overflow:hidden" testWidth = $( 'body' ).width() - testWidth; // Width has changed - compensate missing scrollbars if ( testWidth > 1 ) { $( '