"use strict"; var $ = jQuery; //Form Stylization function formStylization(){ var radio = 'input[type="radio"]', checkbox = 'input[type="checkbox"]'; $(radio).wrap('
').closest('.new-radio').append(''); $(checkbox).wrap('').closest('.new-checkbox').append(''); $(checkbox + ':checked').parent('.new-checkbox').addClass('checked'); $(radio + ':checked').parent('.new-radio').addClass('checked'); $(checkbox + ':disabled').closest('.checkbox').addClass('disabled'); $(radio + ':disabled').closest('.radio').addClass('disabled'); $('body').on('click', function(){ $(radio).parent('.new-radio').removeClass('checked'); $(radio + ':checked').parent('.new-radio').addClass('checked'); $(checkbox).parent('.new-checkbox').removeClass('checked'); $(checkbox + ':checked').parent('.new-checkbox').addClass('checked'); $(radio).closest('.radio').removeClass('disabled'); $(checkbox).closest('.checkbox').removeClass('disabled'); $(radio + ':disabled').closest('.radio').addClass('disabled'); $(checkbox + ':disabled').closest('.checkbox').addClass('disabled'); }); if($.fn.selectpicker){ $('select:not(".without-styles")').selectpicker(); } } //Main Menu function mainMenu(){ var menu = $('#main-menu'), link = $('#main-menu a, .go-section'), url = window.location.href, hash = url.substring(url.indexOf('#')), homeId = 'home'; link.on('click', function(e){ var $this = $(this), id = $this.attr('href').split('#').pop(), duration = 1; e.preventDefault(); if (!$('#' + id).length) { console.log('No such section!'); return false; } link.removeClass('active'); animateFinish(); $('.section.active [data-out-animation]').each(function(){ var $this = $(this); if ($this.data('outAnimationDelay')){ if ($this.data('outAnimationDelay') >= duration) { duration = $this.data('outAnimationDelay'); } } }); if (!$this.hasClass('open')) { link.removeClass('open'); menu.find('[href="#'+ id +'"]').addClass('active').addClass('open'); $('body').find('.preloader').delay(duration + 500).fadeIn(400, function() { $('.section').removeClass('active'); $('#' + id).addClass('active'); $(this).fadeOut(400); setTimeout(function(){ contentScroll(); animateStart(); }, 0); document.location.hash = '#' + id; }); } else { $('body').find('.preloader').delay(duration + 500).fadeIn(400, function() { link.removeClass('open'); $('.section').removeClass('active'); $('#' + homeId).addClass('active'); $(this).fadeOut(400); setTimeout(function(){ contentScroll(); animateStart(); }, 0); document.location.hash = '#' + homeId; }); } }); if (hash != '#') $('[href="'+ hash +'"]').trigger('click'); } //Animate Start function animateStart(){ var activeSection = $('.section.active'); $('[data-animation]').each(function(){ var $this = $(this), animation = 'fadeIn', delay = 1; if ($this.data('animation')){ animation = $this.data('animation'); } if ($this.data('animationDelay')){ delay = $this.data('animationDelay'); } if ($this.closest('.section').hasClass('active')){ $this.css('animation-delay', delay + 'ms').addClass('animated').addClass(animation); } }); } //Animate Finish function animateFinish(){ var activeSection = $('.section.active'), duration = 1; $('[data-out-animation]').each(function(){ var $this = $(this), animation = 'fadeIn', outAnimation = 'fadeOut', delay = 1, outDelay = 1; if ($this.data('animation')){ animation = $this.data('animation'); } if ($this.data('outAnimation')){ outAnimation = $this.data('outAnimation'); } if ($this.data('animationDelay')){ delay = $this.data('animationDelay'); } if ($this.data('outAnimationDelay')){ outDelay = $this.data('outAnimationDelay'); } $this.css('animation-delay', delay + 'ms'); if ($this.closest('.carousel')) { var carousel = $this.closest('.carousel'), carouselAnimate = 'zoomIn'; if (carousel.data('carouselAnimation')){ carouselAnimate = carousel.data('carouselAnimation'); } $this.removeClass(carouselAnimate); } if ($this.closest('.section').hasClass('active')){ if (outDelay >= duration) { duration = outDelay; } $this.removeClass(animation).addClass(outAnimation); if ($this.data('outAnimationDelay')){ $this.css('animation-delay', outDelay + 'ms'); } else { $this.css('animation-delay', '1ms'); } } else { $this.removeClass(animation).removeClass(outAnimation).removeAttr('style', 'animation-delay'); } }); } //Carousels function carousels(){ var carouselBox = $('.carousel-box'); carouselBox.each(function(){ var thisBox = $(this), carousel = $(this).find('.carousel'), animation = 'zoomIn', animationOut = 'zoomOut', items = {0 : {items : 1}, 768 : { items : 3}}; if (thisBox.data('carouselAnimation')){ animation = thisBox.data('carouselAnimation'); } if (thisBox.data('carouselOutAnimation')){ animationOut = thisBox.data('carouselOutAnimation'); } carousel.owlCarousel({ loop : true, margin : 20, pullDrag : false, responsiveClass : true, responsive : items, mouseDrag : false, touchDrag : false, navRewind : false, dots : false }).touchwipe({ wipeLeft: function(){ thisBox.find('.carousel-controls .next').trigger('click'); }, wipeRight: function(){ thisBox.find('.carousel-controls .prev').trigger('click'); }, preventDefaultEvents: false }); carousel.closest('.carousel-box').on('click', '.nav-item', function(e){ var item = carousel.find('.owl-item .item'); e.preventDefault(); item.css('animation-delay', '1ms'); item.each(function(){ var $this = $(this); if ($this.data('animation')){ $this.removeClass($this.data('animation')); } $this.addClass(animationOut); }); var event = 'next'; if ($(this).hasClass('prev')) { event = 'prev'; } setTimeout(function(){ carousel.trigger(event + '.owl.carousel'); }, 400); setTimeout(function(){ item.removeClass(animationOut).addClass(animation); }, 800); }); }); } //Google Map function initialize(){ var mapCanvas = $('.map-canvas'); mapCanvas.each(function (){ var $this = $(this), zoom = 8, lat = -34, lng = 150, scrollwheel = false, draggable = true, mapType = google.maps.MapTypeId.ROADMAP, title = '', contentString = ''; if ($this.data('zoom')){ zoom = parseFloat($this.data('zoom')); } if ($this.data('lat')){ lat = parseFloat($this.data('lat')); } if ($this.data('lng')){ lng = parseFloat($this.data('lng')); } if ($this.data('scrollwheel')){ scrollwheel = $this.data('scrollwheel'); } if ($this.data('type')){ if ($this.data('type') == 'satellite'){ mapType = google.maps.MapTypeId.SATELLITE; } else if ($this.data('type') == 'hybrid'){ mapType = google.maps.MapTypeId.HYBRID; } else if ($this.data('type') == 'terrain'){ mapType = google.maps.MapTypeId.TERRAIN; } } if ($this.data('title')){ title = $this.data('title'); } if( navigator.userAgent.match(/iPad|iPhone|Android/i) ){ draggable = false; } var mapOptions = { zoom : zoom, scrollwheel : scrollwheel, draggable : draggable, center : new google.maps.LatLng(lat, lng), mapTypeId : mapType, streetViewControl : false }; var map = new google.maps.Map($this[0], mapOptions); var is_internetExplorer11= navigator.userAgent.toLowerCase().indexOf('trident') > -1; var image = ( is_internetExplorer11 ) ? 'img/map-marker.png' : 'img/svg/map-marker.svg'; if ($this.data('content')){ contentString = '