/** * Whole-script strict mode syntax * * https://gist.github.com/jamigibbs/5a107b8e8ce854230a7c0dd5dc3f2442 * */ (function($) { 'use strict'; /** Popup Scripts **/ if( $('.popup-gallery').length ){ // Popup for image when class is exists. $('.popup-gallery').magnificPopup({ delegate: 'a', type: 'image', tLoading: 'Loading image #%curr%...', mainClass: 'mfp-img-mobile', gallery: { enabled: true, navigateByImgClick: true, preload: [0,1] }, image: { tError: 'The image #%curr% could not be loaded.', }, zoom: { enabled: true, duration: 300, easing: 'ease-in-out', opener: function(openerElement) { return openerElement.is('img') ? openerElement : openerElement.find('img'); } }, }); } if( $('.popup-youtube, .popup-vimeo, .popup-gmaps').length ){ // video, map, audio link to open popup when class is exists. $('.popup-youtube, .popup-vimeo, .popup-gmaps').magnificPopup({ disableOn: 700, type: 'iframe', mainClass: 'mfp-fade', removalDelay: 160, preloader: false, fixedContentPos: false }); } /** shortcode single popup **/ if( $('.image-popup-vertical-fit').length ){ // Single Popup for image when class is exists. $('.image-popup-vertical-fit').magnificPopup({ type: 'image', closeOnContentClick: true, mainClass: 'mfp-img-mobile', image: { verticalFit: true } }); } if( $('.image-popup-fit-width').length ){ $('.image-popup-fit-width').magnificPopup({ type: 'image', closeOnContentClick: true, image: { verticalFit: false } }); } if( $('.image-popup-no-margins').length ){ $('.image-popup-no-margins').magnificPopup({ type: 'image', closeOnContentClick: true, closeBtnInside: false, fixedContentPos: true, mainClass: 'mfp-no-margins mfp-with-zoom', image: { verticalFit: true }, zoom: { enabled: true, duration: 300 } }); } })(jQuery);