/* |-------------------------------------------------------------------------- | apola.init.js |-------------------------------------------------------------------------- | Initialization of all vendors and modules. */ ;(function($){ 'use strict'; $(function(){ /* ------------------------------------------------ Main Navigation ------------------------------------------------ */ var $nav = $('.apo-navigation').not('.apo-hidden-column .apo-navigation'), $verticalNav = $('.apo-hidden-column .apo-navigation, .apo-navigation-vertical'); if($nav.length){ $nav.wtNav({ cssPrefix: 'apo-' }); } if( $verticalNav.length ) { $verticalNav.wtNav({ cssPrefix: 'apo-', mobileBreakpoint: 10000 }) } /* ------------------------------------------------ End of Main Navigation ------------------------------------------------ */ /* ------------------------------------------------ Fancybox ------------------------------------------------ */ var $contentImageLinks = $('.apo-entry-content a:not(.apo-project-cover-link)[href$=".jpg"], .apo-entry-content a:not(.apo-project-cover-link)[href$=".jpeg"], .apo-entry-content a:not(.apo-project-cover-link)[href$=".png"], .apo-page-content a:not(.apo-project-cover-link)[href$=".jpg"], .apo-page-content a:not(.apo-project-cover-link)[href$=".jpeg"], .apo-page-content a:not(.apo-project-cover-link)[href$=".png"]'), $widgetGalleryItems = $('.apo-widget .gallery-icon > a[href$=".jpeg"], .apo-widget .gallery-icon > a[href$=".jpg"], .apo-widget .gallery-icon > a[href$=".png"]'); if($contentImageLinks.length) { $contentImageLinks.fancybox({ buttons : ['close', 'download'] }); } if($widgetGalleryItems.length) { $widgetGalleryItems.fancybox({ buttons : ['close', 'download'] }); } /* ------------------------------------------------ End of Fancybox ------------------------------------------------ */ /* ------------------------------------------------ Newsletter Form ------------------------------------------------ */ var newsletterForm = $('.apo-newsletter-form'); if(newsletterForm.length) { $.Apola.modules.newsletter(newsletterForm); } /* ------------------------------------------------ End of Newsletter Form ------------------------------------------------ */ /* ------------------------------------------------ Contact Form ------------------------------------------------ */ var contactForm = $('.apo-contact-form'); if(contactForm.length) { $.Apola.modules.contactForm(contactForm); } /* ------------------------------------------------ End of Contact Form ------------------------------------------------ */ /* ------------------------------------------------ Custom Select ------------------------------------------------ */ var $selects = $('.apo-widget select, .wpcf7 select'); if($selects.length){ $selects.wrap('
'); $selects.closest('.apo-custom-select').MadCustomSelect({ cssPrefix: 'apo-' }); } /* ------------------------------------------------ End of Custom Select ------------------------------------------------ */ }); $(window).on('load', function(){ /* ------------------------------------------------ Revolution Slider ------------------------------------------------ */ var secondaryRev, thumbs = $('.apo-slider-thumbs'), swiperInstance, $w = $(window), swiperResizeTimeoutId, swiperOptions, revControls = $('.apo-revslider-controls'); if( $.fn.revolution ) { $.Apola.jQueryRevSlider = jQuery('#rev-slider-1').show().revolution({ delay: 9000, sliderLayout: 'fullscreen', disableProgressBar: "on", spinner: 'spinner2', // fullScreenOffsetContainer: '#apo-header', responsiveLevels: [4096,1024,778,480], navigation : { onHoverStop: "off", keyboardNavigation: 'on', touch:{ touchenabled:"on", touchOnDesktop: "off" }, } }); // secondaryRev = jQuery('#rev-slider-2').show().revolution({ // delay: 9000, // sliderLayout: 'fullscreen', // disableProgressBar: "on", // responsiveLevels: [4096,1281,778,480], // gridwidth: [1400, 900, 778, 480], // gridheight: [900, 600, 500, 400], // navigation : { // onHoverStop: "off", // keyboardNavigation: 'on', // touch:{ // touchenabled:"on", // touchOnDesktop:"on" // }, // arrows: { // enable: false, // tmp: '', // style: '', // rtl: $.Apola.RTL, // hide_onleave: false, // hide_onmobile: true, // hide_under: 0, // hide_over: 9999, // hide_delay: 200, // hide_delay_mobile: 1200, // left: { // container: 'slider', // h_align: 'left', // v_align: 'bottom', // h_offset: 200, // v_offset: 100 // }, // right: { // container: 'slider', // h_align: 'left', // v_align: 'bottom', // h_offset: 250, // v_offset: 100 // } // } // } // }); if(revControls.length) { revControls.on('click.ApolaRevSlider', '.apo-revslider-theme-nav-prev', function(e){ if(secondaryRev) secondaryRev.revprev(); if($.Apola.jQueryRevSlider) $.Apola.jQueryRevSlider.revprev(); e.preventDefault(); }) .on('click.ApolaRevSlider', '.apo-revslider-theme-nav-next', function(e){ if(secondaryRev) secondaryRev.revnext(); if($.Apola.jQueryRevSlider) $.Apola.jQueryRevSlider.revnext(); e.preventDefault(); }) .on('click.ApolaRevSlider', '.apo-revslider-control-pause', function(e){ if(secondaryRev) secondaryRev.revpause(); if($.Apola.jQueryRevSlider) $.Apola.jQueryRevSlider.revpause(); $(this).closest('.apo-revslider-controls-item').removeClass('apo-playing'); e.preventDefault(); }) .on('click.ApolaRevSlider', '.apo-revslider-control-play', function(e){ if(secondaryRev) secondaryRev.revresume(); if($.Apola.jQueryRevSlider) $.Apola.jQueryRevSlider.revresume(); $(this).closest('.apo-revslider-controls-item').addClass('apo-playing'); e.preventDefault(); }) } } if( thumbs.length ) { swiperOptions = { slidesPerView: 5, spaceBetween: 10, nextButton: '.swiper-button-next', prevButton: '.swiper-button-prev' }; $.Apola.helpers.revThumbs.init( thumbs , { revAPI: $.Apola.jQueryRevSlider, target: '.apo-slider-thumb' }); if( thumbs.hasClass('apo-slider-thumbs-vr') ) { swiperInstance = new Swiper( thumbs.get(0), $.extend(true, {}, swiperOptions, { slidesPerView: $w.width() < 768 ? 3 : 5, direction: $w.width() < 768 ? 'horizontal' : 'vertical', onInit: function() { if( $w.width() < 768 ) { thumbs.data('swiperDirection', 'horizontal'); } else { thumbs.data('swiperDirection', 'vertical'); } } })); $w.on('resize.ApolaSwiperUpdates', function(e){ if(swiperResizeTimeoutId) clearTimeout(swiperResizeTimeoutId); swiperResizeTimeoutId = setTimeout(function(){ if( $w.width() < 768 && thumbs.data('swiperDirection') === 'vertical' ) { swiperInstance.destroy(true, true); swiperInstance = new Swiper( thumbs.get(0), $.extend(true, {}, swiperOptions, { slidesPerView: 3, direction: 'horizontal', onInit: function() { $.Apola.helpers.dynamicBgImage(); } }) ); thumbs.data('swiperDirection', 'horizontal'); } else if( $w.width() >= 768 && thumbs.data('swiperDirection') === 'horizontal' ) { swiperInstance.destroy(true, true); swiperInstance = new Swiper( thumbs.get(0), $.extend(true, {}, swiperOptions, { slidesPerView: 5, direction: 'vertical', onInit: function() { if( $.Apola.helpers.dynamicBgImage ) { $.Apola.helpers.dynamicBgImage(); } } }) ); thumbs.data('swiperDirection', 'vertical'); } }, 50); }); } else { swiperInstance = new Swiper( thumbs.get(0), $.extend(true, {}, swiperOptions, { slidesPerView: 7, breakpoints: { // when window width is <= 320px 767: { slidesPerView: 2 }, // when window width is <= 992px 992: { slidesPerView: 7 }, // when window width is <= 1200px 1280: { slidesPerView: 5 } }, direction: 'horizontal', onInit: function() { if( $.Apola.helpers.dynamicBgImage ) { $.Apola.helpers.dynamicBgImage(); } } } ) ); } } /* ------------------------------------------------ Owl Carousel ------------------------------------------------ */ var stripedPhotosCarousel = $('.apo-striped-photos.owl-carousel'), prevButtonText, nextButtonText, stripedPhotosCarouselItems; if(stripedPhotosCarousel.length) { stripedPhotosCarouselItems = stripedPhotosCarousel.find('.apo-striped-photo'); if(stripedPhotosCarouselItems.length > 1) { $.Apola.modules.OWLCarousel.init( stripedPhotosCarousel, { loop: true, nav: true, mouseDrag: false, // !important touchDrag: false, itemsGrow: true, navText: ['' + (ApolaLocalizationData.prevButtonText ? ApolaLocalizationData.prevButtonText : 'Prev') + ' ', '' +(ApolaLocalizationData.nextButtonText ? ApolaLocalizationData.nextButtonText : 'Next')+ ' '], responsive: { 0: { items: 1, itemsGrow: false // important custom option }, 600: { items: stripedPhotosCarouselItems.length >= 2 ? 2 : stripedPhotosCarouselItems.length }, 768: { items: stripedPhotosCarouselItems.length >= 2 ? 2 : stripedPhotosCarouselItems.length }, 991: { items: stripedPhotosCarouselItems.length >= 3 ? 3 : stripedPhotosCarouselItems.length, itemsGrow: true // important custom option }, 1280: { items: stripedPhotosCarouselItems.length >= 5 ? 5 : stripedPhotosCarouselItems.length } }, onInitialized: function() { setTimeout(function(){ stripedPhotosCarousel.trigger('refresh.owl.carousel'); $.Apola.helpers.stripedPhotosCarouselHover.updateItemsInfo(); }, 100); } } ); } } $.Apola.helpers.stripedPhotosCarouselHover.init( $('.apo-striped-photos.owl-carousel'), { duration: 500, easing: 'easeOutCubic', coefficient: 2 } ); /* ------------------------------------------------ End Owl Carousel ------------------------------------------------ */ /* ------------------------------------------------ Parallax ------------------------------------------------ */ setTimeout(function(){ var $parallaxSections = $('.apo-section-parallax'), refreshParallaxTimeOutId; if($parallaxSections.length) { $parallaxSections.parallax(); $(window).on('resize.ApoParallaxRefresh', function(e){ if(refreshParallaxTimeOutId) clearTimeout(refreshParallaxTimeOutId); refreshParallaxTimeOutId = setTimeout(function(){ $(window).trigger('resize').trigger('scroll'); }, 100); }); } }, 1000); /* ------------------------------------------------ End of Parallax ------------------------------------------------ */ /* ------------------------------------------------ Custom Scrollbar ------------------------------------------------ */ var $customScrollbar = $('.apo-hidden-column .apo-hidden-column-content .apo-navigation-container'); if($customScrollbar.length) { $customScrollbar.mCustomScrollbar({ scrollInertia: 120, contentTouchScroll: true, documentTouchScroll: true }); } /* ------------------------------------------------ End of Custom Scrollbar ------------------------------------------------ */ }); })(jQuery);