$(window).on("load", function () { "use strict"; /* Variables */ var $container, $container_blog, DropDown, filter, obj, opt, filterValue, docHeight, winHeight, static_img, slideshow, footer; /* Loader */ $("body").addClass("loaded"); /* Dropdown function */ DropDown = function (el) { this.filter = el; this.placeholder = this.filter.children('span'); this.opts = this.filter.find('ul.dropdown > li'); this.val = ''; this.index = -1; this.initEvents(); }; /* Slideshow Background */ slideshow = $('.slideshow'); if (slideshow.length > 0) { slideshow.vegas({ preload: false, timer: false, delay: 5000, transition: 'fade', transitionDuration: 1000, slides: [ {src: './assets/images/slider/bg-1.jpg'}, {src: './assets/images/slider/bg-2.jpg'} ], overlay: './assets/css/overlays/05.png' }); } /* Static Image Background */ static_img = $('.static-img'); if (static_img.length > 0) { static_img.vegas({ preload: false, timer: false, delay: 5000, transition: 'fade', transitionDuration: 1000, slides: [ {src: static_img.data("background")} ], overlay: './assets/css/overlays/05.png' }); } /* Sliders */ $("#portfolio-slider, #blog-slider").owlCarousel({ slideSpeed: 300, paginationSpeed: 400, singleItem: true, items: 1 }); /* resize half-bg & fixed footer */ function resize() { docHeight = $(document).height(); winHeight = $(window).height(); footer = $(".footer"); if (docHeight <= winHeight) { footer.addClass("fixed"); } else { footer.removeClass("fixed"); } $(".half-bg").height(docHeight - footer.outerHeight()); } resize(); $(window).on("resize", function () { resize(); }); /* Fit video */ $("#video").fitVids(); /* Google Map */ function initMap() { var mapOptions = { zoom: 14, disableDefaultUI: true, scrollwheel: false, center: new google.maps.LatLng(60.1679324, 24.9390148), styles: [{"featureType":"landscape","stylers":[{"saturation":-100},{"lightness":65},{"visibility":"on"}]},{"featureType":"poi","stylers":[{"saturation":-100},{"lightness":51},{"visibility":"simplified"}]},{"featureType":"road.highway","stylers":[{"saturation":-100},{"visibility":"simplified"}]},{"featureType":"road.arterial","stylers":[{"saturation":-100},{"lightness":30},{"visibility":"on"}]},{"featureType":"road.local","stylers":[{"saturation":-100},{"lightness":40},{"visibility":"on"}]},{"featureType":"transit","stylers":[{"saturation":-100},{"visibility":"simplified"}]},{"featureType":"administrative.province","stylers":[{"visibility":"off"}]},{"featureType":"water","elementType":"labels","stylers":[{"visibility":"on"},{"lightness":-25},{"saturation":-100}]},{"featureType":"water","elementType":"geometry","stylers":[{"hue":"#ffff00"},{"lightness":-25},{"saturation":-97}]}] }; var mapElement = document.getElementById('map'); var map = new google.maps.Map(mapElement, mapOptions); var path = document.location.pathname; var dir = path.substring(0, path.lastIndexOf("/")); } if($("#map").length>0){ initMap(); } /* Portfolio Masonry */ $container = $('#portfolio-wrapper'); $container.isotope({ masonry: { columnWidth: '.portfolio-item', isFitWidth: true }, itemSelector: '.portfolio-item' }); /* Blog Masonry */ $container_blog = $('#blog-grid'); $container_blog.isotope({ masonry: { columnWidth: '.post-item', isFitWidth: true }, itemSelector: '.post-item' }); /* Filter Dropdown */ DropDown.prototype = { initEvents: function () { obj = this; obj.filter.on('click', function (event) { $(this).toggleClass('active'); return false; }); obj.opts.on('click', function () { opt = $(this); obj.val = opt.text(); obj.index = opt.index(); obj.placeholder.text(obj.val); filterValue = opt.data("filter"); $container.isotope({filter: filterValue}); }); }, getValue: function () { return this.val; }, getIndex: function () { return this.index; } }; $(function () { filter = new DropDown($('#filter')); $(document).click(function () { $('.wrapper-dropdown').removeClass('active'); }); }); /* Countdown */ if ($("#countdown").length > 0) { $("#countdown").countdown($("#countdown").attr('data-time'), function (e) { $(this).html(e.strftime("
%DDays
%HHours
%MMinutes
%SSeconds
")); }); } /* Newsletter Form */ if ($("#mc-form").length > 0) { $('#mc-form').ajaxChimp({ url: 'http://altitudscom.us2.list-manage.com/subscribe/post?u=6ea67f91a19c8027d96407e83&id=d78227ae31' }); } /* Smooth Scroll */ $('.smoothscroll a[href*="#"]:not([href="#"])').click(function() { 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 }, 1000); return false; } } }); });