/* * * CUSTOM.JS * */ (function($){ "use strict"; // DETECT TOUCH DEVICE // function is_touch_device() { return !!('ontouchstart' in window) || ( !! ('onmsgesturechange' in window) && !! window.navigator.maxTouchPoints); } // SHOW/HIDE MOBILE MENU // function show_hide_mobile_menu() { $("#mobile-menu-button").on("click", function(e) { e.preventDefault(); $("#mobile-menu").slideToggle(300); }); } // MOBILE MENU // function mobile_menu() { if ($(window).width() < 992) { if ($("#menu").length > 0) { if ($("#mobile-menu").length < 1) { $("#menu").clone().attr({ id: "mobile-menu", class: "" }).insertAfter("#header"); $("#mobile-menu .megamenu > a").on("click", function(e) { e.preventDefault(); $(this).toggleClass("open").next("div").slideToggle(300); }); $("#mobile-menu .dropdown > a").on("click", function(e) { e.preventDefault(); $(this).toggleClass("open").next("ul").slideToggle(300); }); } } } else { $("#mobile-menu").hide(); } } // MENU SLIDE // function menu_slide() { $(".menu-button").on("click", function(e) { e.preventDefault(); e.stopPropagation(); $(".menu-slide-container").toggleClass("menu-open"); }); $(".menu-slide-container ul li.dropdown a, .menu-slide-container ul li.megamenu a").on("click", function(e) { e.stopPropagation(); }); $("body").on("click", function() { if ($(".menu-slide-container").hasClass("menu-open")) { $(".menu-slide-container").removeClass("menu-open"); } }); $(".menu-slide li.dropdown > a").on("click", function(e) { e.preventDefault(); $(this).toggleClass("open").next("ul").slideToggle(300); }); $(".menu-slide li.megamenu > a").on("click", function(e) { e.preventDefault(); $(this).toggleClass("open").next("div").slideToggle(300); }); } // STICKY // function sticky() { var sticky_point = $("#header").innerHeight() + 70; $("#header").clone().attr({ id: "header-sticky", class: "" }).insertAfter("header"); $(window).scroll(function() { if ($(window).scrollTop() > sticky_point) { $("#header-sticky").slideDown(300).addClass("header-sticky"); $("#header .menu ul, #header .menu .megamenu-container").css({"visibility": "hidden"}); } else { $("#header-sticky").slideUp(100).removeClass("header-sticky"); $("#header .menu ul, #header .menu .megamenu-container").css({"visibility": "visible"}); } }); if ($("body").hasClass("header-style-4")) { var sticky_point = $("#header-container").innerHeight(); } } // PROGRESS BARS // function progress_bars() { $(".progress .progress-bar:in-viewport").each(function() { if (!$(this).hasClass("animated")) { $(this).addClass("animated"); $(this).animate({ width: $(this).attr("data-width") + "%" }, 2000); } }); } // CHARTS // function pie_chart() { if (typeof $.fn.easyPieChart !== 'undefined') { $(".pie-chart:in-viewport").each(function() { $(this).easyPieChart({ animate: 1500, lineCap: "square", lineWidth: $(this).attr("data-line-width"), size: $(this).attr("data-size"), barColor: $(this).attr("data-bar-color"), trackColor: $(this).attr("data-track-color"), scaleColor: "transparent", onStep: function(from, to, percent) { $(this.el).find(".pie-chart-percent .value").text(Math.round(percent)); } }); }); } } // COUNTER // function counter() { if (typeof $.fn.jQuerySimpleCounter !== 'undefined') { $(".counter .counter-value:in-viewport").each(function() { if (!$(this).hasClass("animated")) { $(this).addClass("animated"); $(this).jQuerySimpleCounter({ start: 0, end: $(this).attr("data-value"), duration: 2000 }); } }); } } // ODOMETER // function odometer() { if (typeof Odometer !== 'undefined') { $(".odometer:in-viewport").each(function(index) { var new_id = 'odometer-' + index; this.id = new_id; var value = $(this).attr("data-value"); if (!$(this).hasClass("animated")) { $(this).addClass("animated"); setTimeout(function() { document.getElementById(new_id).innerHTML = value; }); } }); } } // STATISTICS // function statistics() { if (typeof Chart !== 'undefined') { $(".statistics-container .animate-chart:in-viewport").each(function() { if(!$(this).hasClass("animated")) { $(this).addClass("animated"); // LINE CHART // var data1 = { labels : ["0", "10", "20", "30", "40", "50", "60"], datasets : [ { fill: "true", label: "Profit", backgroundColor: "transparent", borderWidth: 1, borderColor: "#72d3d5", pointBorderColor: "#72d3d5", pointBackgroundColor: "#fff", pointHoverBackgroundColor: "#fff", pointHoverBorderColor: "#72d3d5", pointBorderWidth: 1, pointHoverBorderWidth: 1, tension: 0, stacked: false, data : ["30", "20", "35", "30", "65", "60", "70"] }, { fill: "true", label: "Revenue", backgroundColor: "transparent", borderWidth: 1, borderColor: "#a18b78", pointBorderColor: "#a18b78", pointBackgroundColor: "#fff", pointHoverBackgroundColor: "#fff", pointHoverBorderColor: "#a18b78", pointBorderWidth: 1, pointHoverBorderWidth: 1, tension: 0, stacked: false, data : ["20", "30", "23", "50", "45", "25", "60"] } ] } if ($("#line-chart").length > 0) { var line_chart = new Chart(document.getElementById("line-chart").getContext("2d"), { type: 'line', data: data1, options: { responsive: true, legend: { display: true, labels: { boxWidth: 12, fontColor: "#838383", fontFamily: "Roboto", fontSize: 12, padding: 20 } }, tooltips: { enabled: false }, scales: { xAxes: [{ display: true, }], yAxes: [{ display: true, ticks: { suggestedMin: 0, suggestedMax: 100, } }] } } }); } // DOUGHNUT CHART // var data2 = { labels: [ "Credibility", "Sustenability", "Economy" ], datasets: [ { data: [20, 10, 70], borderWidth: 0, backgroundColor: [ "#f40b4c", "#a18b78", "#72d3d5" ], hoverBackgroundColor: [ "#f40b4c", "#a18b78", "#72d3d5" ] }] }; if ($("#doughnut-chart").length > 0) { var doughnut_chart = new Chart(document.getElementById("doughnut-chart").getContext("2d"), { type: 'doughnut', data: data2, options: { cutoutPercentage: 80, responsive: true, legend: { display: true, position: "bottom", labels: { boxWidth: 12, fontColor: "#838383", fontFamily: "Roboto", fontSize: 12, padding: 20 } }, tooltips: { enabled: false }, scales: { xAxes: [{ display: false }], yAxes: [{ display: false, }] } } }); } // PIE CHART // var data3 = { labels: [ "Credibility", "Sustenability", "Economy" ], datasets: [ { data: [60, 25, 15], borderWidth: 0, backgroundColor: [ "#a18b78", "#72d3d5", "#f40b4c" ], hoverBackgroundColor: [ "#a18b78", "#72d3d5", "#f40b4c" ] }] }; if ($("#pie-chart").length > 0) { var pie_chart = new Chart(document.getElementById("pie-chart").getContext("2d"), { type: 'pie', data: data3, options: { responsive: true, legend: { display: true, position: "bottom", labels: { boxWidth: 12, fontColor: "#838383", fontFamily: "Roboto", fontSize: 12, padding: 20 } }, tooltips: { enabled: false }, scales: { xAxes: [{ display: false }], yAxes: [{ display: false, }] } } }); } // BAR CHART // var data4 = { labels : ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], datasets : [ { label: "Profit", backgroundColor: "#a18b78", borderColor: "#fff", borderWidth: 3, hoverBorderWidth: 3, hoverBackgroundColor: "#a18b78", hoverBorderColor: "#fff", data : [80, 70, 60, 50, 80, 60, 55, 45, 35, 45, 50, 40] }, { label: "Revenue", backgroundColor: "#72d3d5", borderColor: "#fff", borderWidth: 3, hoverBorderWidth: 3, hoverBackgroundColor: "#72d3d5", hoverBorderColor: "#fff", data : [70, 60, 55, 40, 100, 85, 75, 60, 50, 65, 70, 60] } ] } if ($("#bar-chart").length > 0) { var bar_chart = new Chart(document.getElementById("bar-chart").getContext("2d"), { type: 'bar', data: data4, options: { responsive: true, legend: { display: true, labels: { boxWidth: 12, fontColor: "#838383", fontFamily: "Roboto", fontSize: 12, padding: 20 } }, tooltips: { enabled: true, xPadding: 15 }, scales: { xAxes: [{ display: false }], yAxes: [{ display: false, ticks: { suggestedMin: 0, suggestedMax: 100, } }] } } }); } // AREA CHART // var data5 = { labels : ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], datasets : [ { fill: "true", label: "Profit", backgroundColor: "rgba(161, 139, 120, 0.2)", borderWidth: 1, borderColor: "#a18b78", pointBorderColor: "#a18b78", pointBackgroundColor: "#fff", pointHoverBackgroundColor: "#fff", pointHoverBorderColor: "#a18b78", pointBorderWidth: 1, pointHoverBorderWidth: 1, tension: 0.4, stacked: false, data : [55, 85, 65, 70, 40, 65, 75, 55, 70, 40, 65, 45] }, { fill: "true", label: "Revenue", backgroundColor: "transparent", borderWidth: 1, borderColor: "#72d3d5", pointBorderColor: "#72d3d5", pointBackgroundColor: "#fff", pointHoverBackgroundColor: "#fff", pointHoverBorderColor: "#72d3d5", pointBorderWidth: 1, pointHoverBorderWidth: 1, tension: 0.4, stacked: false, data : [65, 75, 55, 65, 50, 75, 90, 80, 60, 50, 55, 70] } ] } if ($("#area-chart").length > 0) { var area_chart = new Chart(document.getElementById("area-chart").getContext("2d"), { type: 'line', data: data5, options: { responsive: true, legend: { display: true, labels: { boxWidth: 12, fontColor: "#838383", fontFamily: "Roboto", fontSize: 12, padding: 20 } }, tooltips: { enabled: false }, scales: { xAxes: [{ display: true }], yAxes: [{ display: true, ticks: { suggestedMin: 0, suggestedMax: 100, } }] } } }); } } }); } } // LOAD MORE PROJECTS // function load_more_projects() { var number_clicks = 0; $(".load-more").on("click", function(e) { e.preventDefault(); if (number_clicks == 0) { $.ajax({ type: "POST", url: $(".load-more").attr("href"), dataType: "html", cache: false, msg : '', success: function(msg) { $(".isotope").append(msg); $(".isotope").imagesLoaded(function() { $(".isotope").isotope("reloadItems").isotope(); $(".fancybox").fancybox({ prevEffect: 'none', nextEffect: 'none', padding: 0 }); $('.portfolio-item').directionalHover({ overlay: "portfolio-item-hover", easing: "swing", speed: 150 }); }); number_clicks++; $(".load-more").html("Nothing to load"); } }); } }); } // MULTILAYER PARALLAX // function multilayer_parallax() { $(".multilayer-parallax .parallax-layer").each(function(){ var x = parseInt($(this).attr("data-x"), 10), y = parseInt($(this).attr("data-y"), 10); $(this).css({ "left": x + "%", "top": y + "%" }); if ($(this).attr("data-x") === "center") { $(this).addClass("x-center"); } }); } // SHOW/HIDE SCROLL UP // function show_hide_scroll_top() { if ($(window).scrollTop() > $(window).height()/2) { $("#scroll-up").fadeIn(300); } else { $("#scroll-up").fadeOut(300); } } // SCROLL UP // function scroll_up() { $("#scroll-up").on("click", function() { $("html, body").animate({ scrollTop: 0 }, 800); return false; }); } // INSTAGRAM FEED // function instagram_feed() { if ((typeof Instafeed !== 'undefined') & ($("#instafeed").length > 0)) { var nr = $("#instafeed").data('number'); var userid = $("#instafeed").data('user'); var accesstoken = $("#instafeed").data('accesstoken'); var feed = new Instafeed({ target: 'instafeed', get: 'user', userId: userid, accessToken: accesstoken, limit: nr, resolution: 'thumbnail', sortBy: 'most-recent' }); feed.run(); } } // ANIMATIONS // function animations() { if (typeof WOW !== 'undefined') { animations = new WOW({ boxClass: 'wow', animateClass: 'animated', offset: 120, mobile: false, live: true }); animations.init(); } } // EQUAL HEIGHT // function equal_height() { $(".text-boxes-list").each(function() { var x = 0; $(this).find("li").each(function() { if ($(this).height() > x) { x = $(this).height(); } }); $(this).find(".text-box").css("height", x + "px"); }); } // IMAGE BOX // function image_box() { if ($(window).width() > 767 ) { $(".image-box").each(function() { var x = $(this).innerHeight(); $(this).find(".image-box-thumbnail").css("height", x + "px"); }); } else { $(".image-box-thumbnail").css("height", 550); } } // FULL SCREEN // function full_screen() { if ($(window).width() > 767) { $(".full-screen").css("height", $(window).height() + "px"); } else { $(".full-screen").css("height", "auto"); } } // DOCUMENT READY // $(document).ready(function() { // STICKY // if ($("body").hasClass("sticky-header")) { sticky(); } // MENU // if (typeof $.fn.superfish !== 'undefined') { $(".menu").superfish({ delay: 500, animation: { opacity: 'show', height: 'show' }, speed: 'fast', autoArrows: true }); } // SHOW/HIDE MOBILE MENU // show_hide_mobile_menu(); // MOBILE MENU // mobile_menu(); // MENU SLIDE // menu_slide(); // FANCYBOX // if (typeof $.fn.fancybox !== 'undefined') { $(".fancybox").fancybox({ prevEffect: 'none', nextEffect: 'none', padding: 0 }); $(".login .btn").fancybox({ maxWidth: 450, maxHeight: 450, fitToView: false, width: '90%', height: '90%', padding: 0, autoSize: false, closeClick: false, openMethod: 'dropIn', openSpeed: 150, closeMethod: 'dropOut', closeSpeed: 150, beforeShow: function () { $("#main-container").addClass("bluring"); }, afterClose: function () { $("#main-container").removeClass("bluring"); } }); $(".search a").fancybox({ maxWidth: 1140, maxHeight: 100, fitToView: false, width: '90%', height: '100%', padding: 0, autoSize: false, closeClick: false, openMethod: 'dropIn', openSpeed: 150, closeMethod: 'dropOut', closeSpeed: 150, beforeShow: function () { $("#main-container").addClass("bluring"); }, afterClose: function () { $("#main-container").removeClass("bluring"); } }); } // REVOLUTION SLIDER // if (typeof $.fn.revolution !== 'undefined') { $(".rev_slider").revolution({ sliderType: "standard", sliderLayout: "auto", delay: 5000, navigation: { arrows:{ style: "erinyen", enable: true, hide_onmobile: true, hide_onleave: false, hide_delay: 200, hide_delay_mobile: 1200, hide_under: 0, hide_over: 9999, tmp: '