jQuery(function ($) { "use strict"; /* ========================================================================= */ /* Page Preloader /* ========================================================================= */ $(window).on('load', function () { $('.preloader').fadeOut(100); }); /* ========================================================================= */ /* Magnific popup /* ========================================================================= */ $('.image-popup').magnificPopup({ type: 'image', removalDelay: 160, //delay removal by X to allow out-animation callbacks: { beforeOpen: function () { // just a hack that adds mfp-anim class to markup this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim'); this.st.mainClass = this.st.el.attr('data-effect'); } }, closeOnContentClick: true, midClick: true, fixedContentPos: false, fixedBgPos: true }); /* ========================================================================= */ /* Portfolio Filtering Hook /* ========================================================================= */ var containerEl = document.querySelector('.shuffle-wrapper'); if (containerEl) { var Shuffle = window.Shuffle; var myShuffle = new Shuffle(document.querySelector('.shuffle-wrapper'), { itemSelector: '.shuffle-item', buffer: 1 }); jQuery('input[name="shuffle-filter"]').on('change', function (evt) { var input = evt.currentTarget; if (input.checked) { myShuffle.filter(input.value); } }); } /* ========================================================================= */ /* Testimonial Carousel /* ========================================================================= */ $("#testimonials").slick({ infinite: true, arrows: false, autoplay: true, autoplaySpeed: 4000 }); /* ========================================================================= */ /* Animated section /* ========================================================================= */ var wow = new WOW({ offset: 100, // distance to the element when triggering the animation (default is 0) mobile: false // trigger animations on mobile devices (default is true) }); var scrolled = false; $(window).on('scroll', function () { if (!scrolled) { scrolled = true; wow.init(); } }) /* ========================================================================= */ /* animation scroll js /* ========================================================================= */ var html_body = $('html, body'); $('nav a, .page-scroll').on('click', function () { //use page-scroll class in any HTML tag for scrolling if (location.pathname.replace(/^\//, '') === this.pathname.replace(/^\//, '') && location.hostname === this.hostname) { var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) + ']'); if (target.length) { html_body.animate({ scrollTop: target.offset().top - 70 }, 1500, 'easeInOutExpo'); return false; } } }); // easeInOutExpo Declaration jQuery.extend(jQuery.easing, { easeInOutExpo: function (x, t, b, c, d) { if (t === 0) { return b; } if (t === d) { return b + c; } if ((t /= d / 2) < 1) { return c / 2 * Math.pow(2, 10 * (t - 1)) + b; } return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b; } }); /* ========================================================================= */ /* counter up /* ========================================================================= */ function counter() { var oTop; if ($('.count').length !== 0) { oTop = $('.count').offset().top - window.innerHeight; } if ($(window).scrollTop() > oTop) { $('.count').each(function () { var $this = $(this), countTo = $this.attr('data-count'); $({ countNum: $this.text() }).animate({ countNum: countTo }, { duration: 1000, easing: 'swing', step: function () { $this.text(Math.floor(this.countNum)); }, complete: function () { $this.text(this.countNum); } }); }); } } $(window).on('scroll', function () { counter(); }); /* ========================================================================= */ /* Google Map Customization /* ========================================================================= */ function initialize() { var latitude = $('#map-canvas').attr('data-latitude'); var longitude = $('#map-canvas').attr('data-longitude'); var myLatLng = new google.maps.LatLng(latitude, longitude); var roadAtlasStyles = [{ "featureType": "landscape", "elementType": "geometry.fill", "stylers": [{ "color": "#2F3238" }] }, { "elementType": "labels.text.fill", "stylers": [{ "color": "#FFFFFF" }] }, { "elementType": "labels.text.stroke", "stylers": [{ "visibility": "off" }] }, { "featureType": "road", "elementType": "geometry.fill", "stylers": [{ "color": "#50525f" }] }, { "featureType": "road", "elementType": "geometry.stroke", "stylers": [{ "visibility": "on" }, { "color": "#808080" }] }, { "featureType": "poi", "elementType": "labels", "stylers": [{ "visibility": "off" }] }, { "featureType": "transit", "elementType": "labels.icon", "stylers": [{ "visibility": "off" }] }, { "featureType": "poi", "elementType": "geometry", "stylers": [{ "color": "#808080" }] }, { "featureType": "water", "elementType": "geometry.fill", "stylers": [{ "color": "#3071a7" }, { "saturation": -65 }] }, { "featureType": "road", "elementType": "labels.icon", "stylers": [{ "visibility": "off" }] }, { "featureType": "landscape", "elementType": "geometry.stroke", "stylers": [{ "color": "#bbbbbb" }] }]; var mapOptions = { zoom: 14, center: myLatLng, disableDefaultUI: true, scrollwheel: false, navigationControl: false, mapTypeControl: false, scaleControl: false, draggable: false, mapTypeControlOptions: { mapTypeIds: [google.maps.MapTypeId.ROADMAP, 'roadatlas'] } }; var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions); var marker = new google.maps.Marker({ position: myLatLng, map: map, title: '', }); google.maps.event.addListener(marker, 'click', function () { infowindow.open(map, marker); }); var styledMapOptions = { name: 'US Road Atlas' }; var usRoadMapType = new google.maps.StyledMapType( roadAtlasStyles, styledMapOptions); map.mapTypes.set('roadatlas', usRoadMapType); map.setMapTypeId('roadatlas'); } google.maps.event.addDomListener(window, "load", initialize) });