; (function ($) { 'use strict' var hereSection = function () { $(window).on('load resize', function () { var adminBarHeight = 0, topBarHeight = 0, contentTopMargin = 0, heroHeight = 0, hero = $('.hero-section'), windowHeight = $(window).height(), headerHeight = $('#site-header-wrap').outerHeight(), heroContent = hero.find('.hero-content'), contentHeight = heroContent.outerHeight(); heroHeight = hero.data('height'); if ($('body').hasClass('header-style-2')) { headerHeight = 0; topBarHeight = 0; } if (heroHeight != 'full') { heroHeight = parseInt(heroHeight, 10); } else { heroHeight = windowHeight - headerHeight; } hero.css({ height: heroHeight + "px" }); contentTopMargin = (heroHeight - contentHeight) / 2; heroContent.css("margin-top", contentTopMargin + "px"); }) if ($().vegas) { $(".hero-section.slideshow").each(function () { var $this = $(this), count = $this.data('count'), count = parseInt(count, 10), effect = $this.data('effect'), images = $this.data('image'), cOverlay = $this.data('overlay'), pOverlay = $this.data('poverlay'), i = 0, slides = [], imgs = images.split('|'); while (i < count) { slides.push({ src: imgs[i] }); i++; } $this.vegas({ slides: slides, overlay: true, transition: effect, walk: (window.vegas_walk || function () { }) }); // var overlay = $('
', { // class: 'overlay', // style: 'background:' + cOverlay // }); // $(this).append(overlay) // .find('.vegas-overlay') // .addClass(pOverlay); }); } if ($().textrotator) { $(".wprt-fancy-text.rotate").each(function () { var $this = $(this), $animation = $this.attr('data-animation'), $speed = parseInt($this.attr('data-speed'), 10); $this.find('.rotates').textrotator({ animation: 'fade', speed: 1200 }).css('opacity', 1); }); } if ($('.wprt-fancy-text').is('.scroll')) { $('.wprt-fancy-text.scroll').each(function () { var $this = $(this), current = 1, height = $this.height(), numberDivs = $this.children().length, first = $this.children('.heading:nth-child(1)'); setInterval(function () { var number = current * -height; first.css('margin-top', number + 'px'); if (current === numberDivs) { first.css('margin-top', '0px'); current = 1; } else current++; }, 2500); }); } if ($('.wprt-fancy-text').is('.typed')) { if ($().typed) { $('.wprt-fancy-text.typed').each(function () { var $this = $(this), texts = $this.data('fancy').split(','); $this.find('.text').typed({ strings: texts, typeSpeed: 40, loop: true, backDelay: 2000 }); }); } } if ($().fitText) { $('.wprt-fancy-text.scroll').each(function () { var min = $(this).data("min"); var max = $(this).data("max"); $(this).children('.heading').fitText(1.8, { minFontSize: min, maxFontSize: max }); }); } }; var galleriesCube = function () { if ($().cubeportfolio) { $('.wprt-gallery-grid').each(function () { var $this = $(this), item = $this.data("column"), item2 = $this.data("column2"), item3 = $this.data("column3"), item4 = $this.data("column4"), gapH = Number($this.data("gaph")), gapV = Number($this.data("gapv")), filter = $this.data("filter"); if (!filter) { filter = '*'; } else { filter = '.' + filter; } $(this).find('#galleries').cubeportfolio({ filters: '#gallery-filter', layoutMode: 'grid', defaultFilter: filter, animationType: 'quicksand', gapHorizontal: gapH, gapVertical: gapV, showNavigation: true, showPagination: true, gridAdjustment: 'responsive', rewindNav: false, auto: false, mediaQueries: [{ width: 1500, cols: item }, { width: 1100, cols: item }, { width: 800, cols: item2 }, { width: 550, cols: item3 }, { width: 320, cols: item4 }], caption: ' ', displayType: 'bottomToTop', displayTypeSpeed: 100 }); }); } }; var imagesCube = function () { $('.wprt-images-grid').each(function () { var $this = $(this), layout = $this.data("layout"), item = $this.data("column"), item2 = $this.data("column2"), item3 = $this.data("column3"), item4 = $this.data("column4"), layout = $this.data("layout"), gapH = Number($this.data("gaph")), gapV = Number($this.data("gapv")); $(this).find('#images-wrap').cubeportfolio({ layoutMode: layout, defaultFilter: '*', animationType: 'quicksand', gapHorizontal: gapH, gapVertical: gapV, showNavigation: true, showPagination: true, gridAdjustment: 'responsive', rewindNav: false, auto: false, mediaQueries: [{ width: 1500, cols: item }, { width: 1100, cols: item }, { width: 800, cols: item2 }, { width: 550, cols: item3 }, { width: 320, cols: item4 }], caption: ' ', displayType: 'bottomToTop', displayTypeSpeed: 100 }); }); }; var thumbSlider = function () { $('.wprt-thumb-slider').each(function () { var itemW = $(this).data("width"), itemM = $(this).data("margin"); $(this).children('#wprt-carousel').flexslider({ animation: "slide", controlNav: false, animationLoop: false, slideshow: false, itemWidth: itemW, itemMargin: itemM, asNavFor: $(this).children('#wprt-slider'), prevText: '', nextText: '' }); $(this).children('#wprt-slider').flexslider({ animation: "slide", controlNav: false, animationLoop: false, slideshow: false, sync: $(this).children('#wprt-carousel'), prevText: '', nextText: '' }); }); }; var carouselBoxOwl = function () { if ($().owlCarousel) { $('.wprt-carousel-box').each(function () { var $this = $(this), auto = $this.data("auto"), loop = $this.data("loop"), item = $this.data("column"), item2 = $this.data("column2"), item3 = $this.data("column3"), gap = Number($this.data("gap")); $this.find('.owl-carousel').owlCarousel({ loop: loop, margin: gap, nav: true, navigation: true, pagination: true, autoplay: auto, autoplayTimeout: 5000, responsive: { 0: { items: item3 }, 600: { items: item2 }, 1000: { items: item } } }); }); } }; var galleryOwl = function () { if ($().owlCarousel) { $('.wprt-gallery').each(function () { var $this = $(this), loop = $this.data("loop"), auto = $this.data("auto"), item = $this.data("column"), item2 = $this.data("column2"), item3 = $this.data("column3"), gap = Number($this.data("gap")); $this.find('.owl-carousel').owlCarousel({ loop: loop, margin: gap, nav: true, navigation: true, pagination: true, autoplay: auto, autoplayTimeout: 5000, responsive: { 0: { items: item3 }, 600: { items: item2 }, 1000: { items: item } } }); }); } }; var newsOwl = function () { if ($().owlCarousel) { $('.wprt-news').each(function () { var $this = $(this), auto = $this.data("auto"), item = $this.data("column"), item2 = $this.data("column2"), item3 = $this.data("column3"), gap = Number($this.data("gap")); $this.find('.owl-carousel').owlCarousel({ loop: false, margin: gap, nav: true, navigation: true, pagination: true, autoplay: auto, autoplayTimeout: 5000, responsive: { 0: { items: item3 }, 600: { items: item2 }, 1000: { items: item } } }); }); } }; var teamOwl = function () { if ($().owlCarousel) { $('.wprt-team').each(function () { var $this = $(this), auto = $this.data("auto"), item = $this.data("column"), item2 = $this.data("column2"), item3 = $this.data("column3"), gap = Number($this.data("gap")); $this.find('.owl-carousel').owlCarousel({ loop: false, margin: gap, nav: true, navigation: true, pagination: true, autoplay: auto, autoplayTimeout: 5000, responsive: { 0: { items: item3 }, 600: { items: item2 }, 1000: { items: item } } }); }); } }; var partnerOwl = function () { if ($().owlCarousel) { $('.wprt-partner').each(function () { var $this = $(this), auto = $this.data("auto"), loop = $this.data("loop"), item = $this.data("column"), item2 = $this.data("column2"), item3 = $this.data("column3"), gap = Number($this.data("gap")); $this.find('.owl-carousel').owlCarousel({ loop: loop, margin: gap, nav: true, navigation: true, pagination: true, autoplay: auto, autoplayTimeout: 5000, responsive: { 0: { items: item3 }, 600: { items: item2 }, 1000: { items: item } } }); }); } }; var progressBar = function () { if ($().waypoint) { $('.progress-bg').on('on-appear', function () { $(this).each(function () { var percent = parseInt($(this).data('percent')); $(this).find('.progress-animate').animate({ "width": percent + '%' }, 1000, "easeInCirc"); $(this).parent('.wprt-progress').find('.perc').addClass('show').animate({ "width": percent + '%' }, 1000, "easeInCirc"); }); }); } }; var accordions = function () { var args = { easing: 'easeOutExpo', duration: 300 }; $('.accordion-item.active').find('.accordion-content').show(); $('.accordion-heading').on('click', function () { if (!$(this).parent().is('.active')) { $(this).parent().toggleClass('active') .children('.accordion-content').slideToggle(args) .parent().siblings('.active').removeClass('active') .children('.accordion-content').slideToggle(args); } else { $(this).parent().toggleClass('active'); $(this).next().slideToggle(args); } }); }; var counter = function () { if ($().countTo) { $('.wprt-counter').on('on-appear', function () { $(this).find('.number').each(function () { var to = $(this).data('to'), speed = $(this).data('speed'); $(this).countTo({ to: to, speed: speed }); }); }); } }; var tabs = function () { $('.wprt-tabs').each(function () { var list = "", title = $(this).find('.item-title'), titleWrap = $(this).children('.tab-title'); title.each(function () { list = list + "
  • " + $(this).html() + "
  • "; }).appendTo(titleWrap); $(this).find('.tab-title li').filter(':first').addClass('active'); $(this).find('.tab-content-wrap').children().hide().filter(':first').show(); $(this).find('.tab-title li').on('click', function (e) { var idx = $(this).index(), content = $(this).closest('.wprt-tabs').find('.tab-content-wrap').children().eq(idx); $(this).addClass('active').siblings().removeClass('active'); content.fadeIn('slow').siblings().hide(); e.preventDefault(); }); }); }; var imagePopup = function () { if ($().magnificPopup) { $('.wprt-gallery, .wprt-gallery-grid, .wprt-thumb-slider, .wprt-images-grid').each(function () { $(this).find('.zoom-popup').magnificPopup({ disableOn: 700, type: 'image', gallery: { enabled: true }, mainClass: 'mfp-fade', removalDelay: 160, preloader: false, fixedContentPos: true }); }); }; }; var videoPopup = function () { if ($().magnificPopup) { $('.popup-video').magnificPopup({ disableOn: 700, type: 'iframe', mainClass: 'mfp-fade', removalDelay: 160, preloader: false, fixedContentPos: true }); }; }; var spacer = function () { $(window).on('load resize', function () { var mode = 'desktop'; if (matchMedia('only screen and (max-width: 991px)').matches) mode = 'mobile'; if (matchMedia('only screen and (max-width: 767px)').matches) mode = 'smobile'; $('.wprt-spacer').each(function () { if (mode == 'desktop') { $(this).attr('style', 'height:' + $(this).data('desktop') + 'px') } else if (mode == 'mobile') { $(this).attr('style', 'height:' + $(this).data('mobi') + 'px') } else { $(this).attr('style', 'height:' + $(this).data('smobi') + 'px') } }) }); }; var contentBox = function () { $(window).on('load resize', function () { var mode = 'desktop'; if (matchMedia('only screen and (max-width: 991px)').matches) mode = 'mobile'; $('.wprt-content-box').each(function () { var margin = $(this).data('margin'); if (margin) { if (mode == 'desktop') { $(this).attr('style', 'margin:' + $(this).data('margin')) } else if (mode == 'mobile') { $(this).attr('style', 'margin:' + $(this).data('mobimargin')) } } }) }); }; var parallax = function () { var iOS = (navigator.userAgent.match(/(iPad|iPhone|iPod)/g) ? true : false); /* * Please note that background attachment fixed doesn't work on iOS */ if (!iOS) { $('.parallax').css({ backgroundAttachment: 'fixed' }); } else { $('.parallax').css({ backgroundAttachment: 'scroll' }); } if ($().parallax && matchMedia('only screen and (min-width: 992px)').matches) { $('.row-certified-1').parallax("50%", 0.45); $('.row-trusted-1').parallax("50%", 0.4); $('.row-facts-1').parallax("50%", 0.5); } }; var scrollTarget = function () { $('.scroll-target').on('click', function () { var anchor = $(this).attr('href').split('#')[1]; if (anchor) { if ($('#' + anchor).length > 0) { var target = $('#' + anchor).offset().top - 74; $('html,body').animate({ scrollTop: target }, 1000, 'easeInOutExpo'); } } return false; }) }; var animation = function () { $('.wprt-animation-block').each(function () { var el = $(this), animate = el.data('animate'), duration = el.data('duration'), delay = el.data('delay'), position = el.data('position'); el.css({ '-webkit-animation-delay': delay, 'animation-delay': delay, '-webkit-animation-duration': duration, 'animation-duration': duration }); el.waypoint(function () { el.addClass('animated').addClass(animate); }, { triggerOnce: true, offset: position }); }); }; var inViewport = function () { $('[data-inviewport="yes"]').waypoint(function () { $(this).trigger('on-appear'); }, { offset: '90%', triggerOnce: true }); $(window).on('load', function () { setTimeout(function () { $.waypoints('refresh'); }, 100); }); }; var ajaxContactForm = function () { if ($().validate) { $('.contact-form').each(function () { $(this).validate({ submitHandler: function (form) { var $form = $(form), str = $form.serialize(); $.ajax({ type: "POST", url: $form.attr('action'), data: str, beforeSend: function () { $form.find('.wprt-alert').remove(); }, success: function (msg) { var result, cls; if (msg == 'Success') { result = 'Your message has been sent. Thank you!'; cls = 'success'; } else { result = 'Error sending email.'; cls = 'error'; } $form.prepend( $('
    ', { 'class': 'wprt-alert ' + cls, 'text': result }).append( $('') ) ); $form.find(':input').not('.submit').val(''); } }); } }); }); } $(document).on('click', '.wprt-alert .remove', function (e) { $(this).parent().slideUp(); e.preventDefault(); }) }; var ajaxApptForm = function () { if ($().validate) { $('.appointment-form').each(function () { $(this).validate({ submitHandler: function (form) { var $form = $(form), str = $form.serialize(); $.ajax({ type: "POST", url: $form.attr('action'), data: str, beforeSend: function () { $form.find('.wprt-alert').remove(); }, success: function (msg) { var result, cls; if (msg == 'Success') { result = 'Your message has been sent. Thank you!'; cls = 'success'; } else { result = 'Error sending email!'; cls = 'error'; } $form.prepend( $('
    ', { 'class': 'wprt-alert ' + cls, 'text': result }).append( $('') ) ); $form.find(':input').not('.submit').val(''); } }); } }); }); } if ($().datepicker) { $("#datepicker").datepicker(); } $('.datepick').on('click', function () { $(this).siblings('input').focus(); return false; }); $(document).on('click', '.wprt-alert .remove', function (e) { $(this).parent().slideUp(); e.preventDefault(); }) }; var googleMap = function () { if ($().gmap3) { $('.wprt-gmap').each(function () { var $this = $(this), lat = $this.data('lat'), lng = $this.data('lng'), marker = $this.data('marker'), zoom = $this.data('zoom'); var center = [lat, lng]; $this .gmap3({ center: center, zoom: zoom, mapTypeId: google.maps.MapTypeId.ROADMAP }) .marker({ position: center, icon: marker }); }); } }; var equalizeHeight = function () { $(window).on('load resize', function () { setTimeout(function () { $(document).imagesLoaded(function () { if (matchMedia('only screen and (max-width: 767px)').matches) { $('.equalize').equalize({ equalize: 'outerHeight', reset: true }); $('.equalize.sm-equalize-auto').children().css("height", ""); return false; } else if (matchMedia('only screen and (max-width: 991px)').matches) { $('.equalize').equalize({ equalize: 'outerHeight', reset: true }); $('.equalize.sm-equalize-auto').children().css("height", ""); return false; } else if (matchMedia('only screen and (max-width: 1199px)').matches) { $('.equalize').equalize({ equalize: 'outerHeight', reset: true }); return false; } else { $('.equalize').equalize({ equalize: 'outerHeight', reset: true }); } }); }, 500); }); }; // Dom Ready $(function () { spacer(); scrollTarget(); hereSection(); galleriesCube(); imagesCube(); thumbSlider(); accordions(); imagePopup(); contentBox(); counter(); animation(); videoPopup(); tabs(); newsOwl(); galleryOwl(); teamOwl(); partnerOwl(); progressBar(); equalizeHeight(); ajaxContactForm(); ajaxApptForm(); googleMap(); $(window).load(function () { carouselBoxOwl(); parallax(); inViewport(); }); }); })(jQuery);