"use strict"; var lastScroll = 0; //check for browser os var isMobile = false; var isiPhoneiPad = false; if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { isMobile = true; } if (/iPhone|iPad|iPod/i.test(navigator.userAgent)) { isiPhoneiPad = true; } function SetMegamenuPosition() { if ($(window).width() > 991) { setTimeout(function () { var totalHeight = $('nav.navbar').outerHeight(); $('.mega-menu').css({top: totalHeight}); if ($('.navbar-brand-top').length === 0) $('.dropdown.simple-dropdown > .dropdown-menu').css({top: totalHeight}); }, 200); } else { $('.mega-menu').css('top', ''); $('.dropdown.simple-dropdown > .dropdown-menu').css('top', ''); } } function pad(d) { return (d < 10) ? '0' + d.toString() : d.toString(); } function isIE() { var ua = window.navigator.userAgent; var msie = ua.indexOf("MSIE "); if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) // If Internet Explorer, return version number { return true; } else // If another browser, return 0 { return false; } } //page title space function setPageTitleSpace() { if ($('.navbar').hasClass('navbar-top') || $('nav').hasClass('navbar-fixed-top')) { if ($('.top-space').length > 0) { var top_space_height = $('.navbar').outerHeight(); if ($('.top-header-area').length > 0) { top_space_height = top_space_height + $('.top-header-area').outerHeight(); } $('.top-space').css('margin-top', top_space_height + "px"); } } } //swiper button position in auto height slider function setButtonPosition() { if ($(window).width() > 767 && $(".swiper-auto-height-container").length > 0) { var leftPosition = parseInt($('.swiper-auto-height-container .swiper-slide').css('padding-left')); var bottomPosition = parseInt($('.swiper-auto-height-container .swiper-slide').css('padding-bottom')); var bannerWidth = parseInt($('.swiper-auto-height-container .slide-banner').outerWidth()); $('.navigation-area').css({'left': bannerWidth + leftPosition + 'px', 'bottom': bottomPosition + 'px'}); } else if ($(".swiper-auto-height-container").length > 0) { $('.navigation-area').css({'left': '', 'bottom': ''}); } } $(window).on("scroll", init_scroll_navigate); function init_scroll_navigate() { /*============================================================== One Page Main JS - START CODE =============================================================*/ var menu_links = $(".navbar-nav li a"); var scrollPos = $(document).scrollTop(); menu_links.each(function () { var currLink = $(this); if (currLink.attr("href").indexOf("#") > -1 && $(currLink.attr("href")).length > 0) { var refElement = $(currLink.attr("href")); if (refElement.position().top <= scrollPos && refElement.position().top + refElement.height() > scrollPos) { menu_links.removeClass("active"); currLink.addClass("active"); } else { currLink.removeClass("active"); } } }); /*============================================================== One Page Main JS - END CODE =============================================================*/ /*==============================================================*/ //background color slider Start /*==============================================================*/ var $window = $(window), $body = $('.bg-background-fade'), $panel = $('.color-code'); var scroll = $window.scrollTop() + ($window.height() / 2); $panel.each(function () { var $this = $(this); if ($this.position().top <= scroll && $this.position().top + $this.height() > scroll) { $body.removeClass(function (index, css) { return (css.match(/(^|\s)color-\S+/g) || []).join(' '); }); $body.addClass('color-' + $(this).data('color')); } }); /*==============================================================*/ //background color slider End /*==============================================================*/ /* =================================== sticky nav Start ====================================== */ var headerHeight = $('nav').outerHeight(); if (!$('header').hasClass('no-sticky')) { if ($(document).scrollTop() >= headerHeight) { $('header').addClass('sticky'); } else if ($(document).scrollTop() <= headerHeight) { $('header').removeClass('sticky'); setTimeout(function () { setPageTitleSpace(); }, 500); } SetMegamenuPosition(); } /* =================================== header appear on scroll up ====================================== */ var st = $(this).scrollTop(); if (st > lastScroll) { $('.sticky').removeClass('header-appear'); $('.dropdown.on').removeClass('on').removeClass('open').find('.dropdown-menu').fadeOut(100); } else $('.sticky').addClass('header-appear'); lastScroll = st; if (lastScroll <= headerHeight) $('header').removeClass('header-appear'); /* =================================== sticky nav End ====================================== */ } /*============================================================== parallax text - START CODE ==============================================================*/ function parallax_text() { var window_width = $(window).width(); if (window_width > 1024) { if ($('.swiper-auto-width .swiper-slide').length !== 0) { $(document).on("mousemove", ".swiper-auto-width .swiper-slide", function (e) { var positionX = e.clientX; var positionY = e.clientY; positionX = Math.round(positionX / 10) - 80; positionY = Math.round(positionY / 10) - 40; $(this).find('.parallax-text').css({'transform': 'translate(' + positionX + 'px,' + positionY + 'px)', 'transition-duration': '0s'}); }); $(document).on("mouseout", ".swiper-auto-width .swiper-slide", function (e) { $('.parallax-text').css({'transform': 'translate(0,0)', 'transition-duration': '0.5s'}); }); } } } /*==============================================================*/ //parallax text - END CODE /*==============================================================*/ /*==============================================================*/ //Search - START CODE /*==============================================================*/ function ScrollStop() { return false; } function ScrollStart() { return true; } function validationSearchForm() { var error = true; $('#search-header input[type=text]').each(function (index) { if (index === 0) { if ($(this).val() === null || $(this).val() === "") { $("#search-header").find("input:eq(" + index + ")").css({"border": "none", "border-bottom": "2px solid red"}); error = false; } else { $("#search-header").find("input:eq(" + index + ")").css({"border": "none", "border-bottom": "2px solid #000"}); } } }); return error; } /*============================================================== Search - END CODE ==============================================================*/ /*============================================================== equalize - START CODE ==============================================================*/ function equalizeHeight() { $(document).imagesLoaded(function () { if ($(window).width() < 768) { $('.equalize').equalize({equalize: 'outerHeight', reset: true}); $('.equalize.md-equalize-auto').children().css("height", ""); $('.equalize.sm-equalize-auto').children().css("height", ""); $('.equalize.xs-equalize-auto').children().css("height", ""); return false; } else if ($(window).width() < 992) { $('.equalize').equalize({equalize: 'outerHeight', reset: true}); $('.equalize.md-equalize-auto').children().css("height", ""); $('.equalize.sm-equalize-auto').children().css("height", ""); return false; } else if ($(window).width() < 1199) { $('.equalize').equalize({equalize: 'outerHeight', reset: true}); $('.equalize.md-equalize-auto').children().css("height", ""); return false; } else { $('.equalize').equalize({equalize: 'outerHeight', reset: true}); } }); } /*============================================================== equalize - END CODE ==============================================================*/ /*============================================================== dynamic font size START CODE ==============================================================*/ function feature_dynamic_font_line_height() { if ($('.dynamic-font-size').length > 0) { var site_width = 1100; var window_width = $(window).width(); if (window_width < site_width) { var window_site_width_ratio = window_width / site_width; $('.dynamic-font-size').each(function () { var font_size = $(this).attr('data-fontsize'); var line_height = $(this).attr('data-lineheight'); if (font_size != '' && font_size != undefined) { var new_font_size = Math.round(font_size * window_site_width_ratio * 1000) / 1000; $(this).css('font-size', new_font_size + 'px'); } if (line_height !== '' && line_height !== undefined) { var new_line_height = Math.round(line_height * window_site_width_ratio * 1000) / 1000; $(this).css('line-height', new_line_height + 'px'); } }); } else { $('.dynamic-font-size').each(function () { var font_size = $(this).attr('data-fontsize'); var line_height = $(this).attr('data-lineheight'); if (font_size !== '' && font_size !== undefined) { $(this).css('font-size', font_size + 'px'); } if (line_height !== '' && line_height !== undefined) { $(this).css('line-height', line_height + 'px'); } }); } } } /*============================================================== dynamic font size END CODE ==============================================================*/ /*============================================================== set parallax ==============================================================*/ function stellarParallax() { if ($(window).width() > 1024) { $.stellar(); } else { $.stellar('destroy'); $('.parallax').css('background-position', ''); } } /*============================================================== full screen START CODE ==============================================================*/ function fullScreenHeight() { var element = $(".full-screen"); var $minheight = $(window).height(); element.parents('section').imagesLoaded(function () { if ($(".top-space .full-screen").length > 0) { var $headerheight = $("header nav.navbar").outerHeight(); $(".top-space .full-screen").css('min-height', $minheight - $headerheight); } else { element.css('min-height', $minheight); } }); var minwidth = $(window).width(); $(".full-screen-width").css('min-width', minwidth); var sidebarNavHeight = $('.sidebar-nav-style-1').height() - $('.logo-holder').parent().height() - $('.footer-holder').parent().height() - 10; $(".sidebar-nav-style-1 .nav").css('height', (sidebarNavHeight)); var style2NavHeight = parseInt($('.sidebar-part2').height() - parseInt($('.sidebar-part2 .sidebar-middle').css('padding-top')) - parseInt($('.sidebar-part2 .sidebar-middle').css('padding-bottom')) - parseInt($(".sidebar-part2 .sidebar-middle .sidebar-middle-menu .nav").css('margin-bottom'))); $(".sidebar-part2 .sidebar-middle .sidebar-middle-menu .nav").css('height', (style2NavHeight)); } /*============================================================== full screen END CODE ==============================================================*/ function SetResizeContent() { // all function call feature_dynamic_font_line_height(); SetMegamenuPosition(); setPageTitleSpace(); setButtonPosition(); parallax_text(); stellarParallax(); fullScreenHeight(); equalizeHeight(); } /* =================================== START RESIZE ====================================== */ $(window).resize(function (event) { // Bootsnav menu work with eualize height $("nav.navbar.bootsnav ul.nav").each(function () { $("li.dropdown", this).on("mouseenter", function (e) { if ($(window).width() > 991) { $(this).find('.equalize').equalize({equalize: 'outerHeight', reset: true}); return false; } }); }); setTimeout(function () { SetResizeContent(); }, 500); event.preventDefault(); }); /* =================================== END RESIZE ====================================== */ /* =================================== START READY ====================================== */ $(document).ready(function () { "use strict"; // Bootsnav menu work with eualize height $("nav.navbar.bootsnav ul.nav").each(function () { $("li.dropdown", this).on("mouseenter", function () { if ($(window).width() > 991) { $(this).find('.equalize').equalize({equalize: 'outerHeight', reset: true}); return false; } }); }); // Bootsnav tab work with eualize height $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { var target = $(e.target).attr("href"); if ($(window).width() > 991) { $(target).find('.equalize').equalize({equalize: 'outerHeight', reset: true}); return false; } }); // Active class to current menu for only html var pgurl = window.location.href.substr(window.location.href.lastIndexOf("/") + 1); var $hash = window.location.hash.substring(1); if ($hash) { $hash = "#" + $hash; pgurl = pgurl.replace($hash, ""); } else { pgurl = pgurl.replace("#", ""); } $(".nav li a").each(function () { if ($(this).attr("href") == pgurl || $(this).attr("href") == pgurl + '.html') { $(this).parent().addClass("active"); $(this).parents('li.dropdown').addClass("active"); } }); $(window).scroll(function () { if ($(this).scrollTop() > 0) $('.scroll-top-arrow').fadeIn('slow'); else $('.scroll-top-arrow').fadeIn('slow'); }); $(".nav li a").each(function () { if ($(this).attr("href") == pgurl || $(this).attr("href") == pgurl + '.html') { $(this).parent().addClass("active"); $(this).parents('li.dropdown').addClass("active"); } }); $(window).scroll(function () { if ($(this).scrollTop() > 0) $('.scroll-top-arrow2').fadeIn('slow'); else $('.scroll-top-arrow2').fadeIn('slow'); }); /* =================================== swiper slider ====================================== */ var swiperFull = new Swiper('.swiper-full-screen', { pagination: '.swiper-pagination', paginationClickable: true, loop: true, autoplay: 20000, slidesPerView: 1, keyboardControl: true, preventClicks: false, nextButton: '.swiper-button-next', prevButton: '.swiper-button-prev' }); var swiperAutoFade = new Swiper('.swiper-auto-fade', { pagination: '.swiper-pagination', loop: true, autoplay: 5000, slidesPerView: 1, paginationClickable: true, keyboardControl: true, preventClicks: false, effect: 'fade', nextButton: '.swiper-button-next', prevButton: '.swiper-button-prev' }); var swiperSecond = new Swiper('.swiper-slider-second', { pagination: '.swiper-pagination-second', slidesPerView: 1, paginationClickable: true, keyboardControl: true, preventClicks: false, nextButton: '.swiper-button-next', prevButton: '.swiper-button-prev' }); var swiperThird = new Swiper('.swiper-slider-third', { pagination: '.swiper-pagination-third', slidesPerView: 1, paginationClickable: true, keyboardControl: true, preventClicks: false, nextButton: '.swiper-button-next', prevButton: '.swiper-button-prev' }); var swiperNumber = new Swiper('.swiper-number-pagination', { pagination: '.swiper-number', paginationClickable: true, autoplay: 4000, preventClicks: false, autoplayDisableOnInteraction: false, paginationBulletRender: function (swiper, index, className) { return '' + pad((index + 1)) + ''; } }); var swiperVerticalPagination = new Swiper('.swiper-vertical-pagination', { pagination: '.swiper-pagination-white', direction: 'vertical', slidesPerView: 1, paginationClickable: true, spaceBetween: 0, preventClicks: false, mousewheelControl: true }); var swiperClients = new Swiper('.swiper-slider-clients', { pagination: null, slidesPerView: 6, paginationClickable: true, autoplay: 3000, preventClicks: false, autoplayDisableOnInteraction: false, breakpoints: { 480: { slidesPerView: 1 }, 650: { slidesPerView: 2 }, 850: { slidesPerView: 3 } } }); var swiperThreeSlides = new Swiper('.swiper-three-slides', { pagination: '.swiper-pagination-three-slides', paginationClickable: true, slidesPerView: 3, keyboardControl: true, mousewheelControl: false, preventClicks: false, nextButton: '.second-swiper-button-next', prevButton: '.second-swiper-button-prev', breakpoints: { 480: { slidesPerView: 1 }, 767: { slidesPerView: 2 }, 850: { slidesPerView: 2 } } }); var swiperFourSlides = new Swiper('.swiper-four-slides', { pagination: '.swiper-pagination-four-slides', autoplay: 3000, slidesPerView: 4, paginationClickable: true, keyboardControl: true, mousewheelControl: false, preventClicks: false, nextButton: '.swiper-button-next', prevButton: '.swiper-button-prev', breakpoints: { 850: { slidesPerView: 2 }, 650: { slidesPerView: 2 }, 480: { slidesPerView: 1 } } }); var swiperDemoHeaderStyle = new Swiper('.swiper-demo-header-style', { pagination: '.swiper-pagination-demo-header-style', loop: true, autoplay: 3000, slidesPerView: 4, paginationClickable: true, keyboardControl: true, mousewheelControl: false, preventClicks: true, slidesPerGroup: 4, nextButton: '.swiper-button-next', prevButton: '.swiper-button-prev', breakpoints: { 1199: { slidesPerGroup: 2, slidesPerView: 2 }, 767: { slidesPerGroup: 1, slidesPerView: 1 } } }); var swiperAutoSlideIndex = 0; var swiperAutoSlide = new Swiper('.swiper-auto-width', { scrollbar: '.swiper-scrollbar', scrollbarHide: false, scrollbarDraggable: true, slidesPerView: 'auto', centeredSlides: true, spaceBetween: 80, preventClicks: false, scrollbarSnapOnRelease: true, nextButton: '.swiper-next-style2', prevButton: '.swiper-prev-style2', mousewheelControl: true, speed: 1000, keyboardControl: true, breakpoints: { 1199: { spaceBetween: 60 }, 960: { spaceBetween: 30 }, 767: { spaceBetween: 15 } }, onSlideChangeEnd: function (swiper) { swiperAutoSlideIndex = swiper.activeIndex; } }); var swiperMultipurpose = new Swiper('.swiper-bottom-scrollbar-full', { scrollbar: '.swiper-scrollbar', scrollbarHide: false, scrollbarDraggable: true, slidesPerView: 'auto', scrollbarSnapOnRelease: true, grabCursor: true, preventClicks: false, nextButton: '.swiper-button-next', prevButton: '.swiper-button-prev', mousewheelControl: true, spaceBetween: 30, keyboardControl: true, speed: 1000, breakpoints: { 767: { direction: 'vertical', //slidesPerView: 1, scrollbarHide: true, spaceBetween: 0, pagination: false, autoHeight: true } } }); var swiperAutoHieght = new Swiper('.swiper-auto-height-container', { nextButton: '.swiper-button-next', prevButton: '.swiper-button-prev', effect: 'fade', loop: true, preventClicks: false, autoHeight: true }); var swiperMultyRow = new Swiper('.swiper-multy-row-container', { nextButton: '.swiper-portfolio-next', prevButton: '.swiper-portfolio-prev', slidesPerView: 4, spaceBetween: 15, scrollbarSnapOnRelease: true, autoplay: 3000, autoplayDisableOnInteraction: true, breakpoints: { 991: { slidesPerView: 2 }, 767: { slidesPerView: 1 } } }); var swiperBlog = new Swiper('.swiper-blog', { slidesPerView: "auto", centeredSlides: true, spaceBetween: 15, scrollbarSnapOnRelease: true, autoplay: 5000, autoplayDisableOnInteraction: true, preventClicks: false, loop: true, loopedSlides: 3 }); var swiperPresentation = new Swiper('.swiper-presentation', { slidesPerView: 4, centeredSlides: true, spaceBetween: 30, scrollbarSnapOnRelease: true, autoplay: 3000, autoplayDisableOnInteraction: true, preventClicks: true, loop: true, loopedSlides: 6, nextButton: '.swiper-button-next', prevButton: '.swiper-button-prev', breakpoints: { 991: { spaceBetween: 15, slidesPerView: 2 }, 767: { slidesPerView: 1 } } }); //swiper resize for IE if (isIE()) { setTimeout(function () { $(document).imagesLoaded(function () { if ($(".swiper-full-screen").length > 0) swiperFull.onResize(); if ($(".swiper-auto-fade").length > 0) swiperAutoFade.onResize(); if ($(".swiper-number-pagination").length > 0) swiperNumber.onResize(); if ($(".swiper-slider-clients").length > 0) swiperClients.onResize(); if ($(".swiper-slider-second").length > 0) swiperSecond.onResize(); if ($(".swiper-slider-third").length > 0) swiperThird.onResize(); if ($(".swiper-three-slides").length > 0) swiperThreeSlides.onResize(); if ($(".swiper-four-slides").length > 0) swiperFourSlides.onResize(); if ($(".swiper-vertical-pagination").length > 0) swiperVerticalPagination.onResize(); if ($(".swiper-auto-height-container").length > 0) swiperAutoHieght.onResize(); if ($(".swiper-multy-row-container").length > 0) swiperMultyRow.onResize(); if ($(".swiper-blog").length > 0) swiperBlog.onResize(); if ($(".swiper-swiperPresentation").length > 0) swiperPresentation.onResize(); if ($(".swiper-demo-header-style").length > 0) swiperDemoHeaderStyle.onResize(); }); }, 300); } $(window).resize(function () { setTimeout(function () { if ($(".swiper-full-screen").length > 0) swiperFull.onResize(); if ($(".swiper-auto-fade").length > 0) swiperAutoFade.onResize(); if ($(".swiper-number-pagination").length > 0) swiperNumber.onResize(); if ($(".swiper-slider-clients").length > 0) swiperClients.onResize(); if ($(".swiper-slider-second").length > 0) swiperSecond.onResize(); if ($(".swiper-slider-third").length > 0) swiperThird.onResize(); if ($(".swiper-three-slides").length > 0) swiperThreeSlides.onResize(); if ($(".swiper-four-slides").length > 0) swiperFourSlides.onResize(); if ($(".swiper-vertical-pagination").length > 0) swiperVerticalPagination.onResize(); if ($(".swiper-auto-height-container").length > 0) swiperAutoHieght.onResize(); if ($(".swiper-multy-row-container").length > 0) swiperMultyRow.onResize(); if ($(".swiper-blog").length > 0) swiperBlog.onResize(); if ($(".swiper-swiperPresentation").length > 0) swiperPresentation.onResize(); if ($(".swiper-demo-header-style").length > 0) swiperDemoHeaderStyle.onResize(); }, 500); setTimeout(function () { //destroy swiper var window_width = $(window).width(); if (window_width < 768) { if ($(".swiper-bottom-scrollbar-full").length > 0) { if (swiperMultipurpose) { swiperMultipurpose.detachEvents(); swiperMultipurpose.destroy(true, true); swiperMultipurpose = undefined; } swiperMultipurpose = new Swiper('.swiper-bottom-scrollbar-full', { scrollbar: '.swiper-scrollbar', scrollbarHide: false, scrollbarDraggable: true, slidesPerView: 'auto', scrollbarSnapOnRelease: true, grabCursor: true, preventClicks: false, nextButton: '.swiper-button-next', prevButton: '.swiper-button-prev', mousewheelControl: true, spaceBetween: 30, keyboardControl: true, speed: 1000, breakpoints: { 767: { direction: 'vertical', //slidesPerView: 1, scrollbarHide: true, spaceBetween: 0, pagination: false, autoHeight: true } } }); } } else { if ($(".swiper-bottom-scrollbar-full").length > 0) { if (swiperMultipurpose) { swiperMultipurpose.detachEvents(); swiperMultipurpose.destroy(true, true); swiperMultipurpose = undefined; } swiperMultipurpose = new Swiper('.swiper-bottom-scrollbar-full', { scrollbar: '.swiper-scrollbar', scrollbarHide: false, scrollbarDraggable: true, slidesPerView: 'auto', scrollbarSnapOnRelease: true, grabCursor: true, preventClicks: false, nextButton: '.swiper-button-next', prevButton: '.swiper-button-prev', mousewheelControl: true, spaceBetween: 30, keyboardControl: true, speed: 1000 }); } } }, 500); if ($(".swiper-auto-width").length > 0 && swiperAutoSlide) { swiperAutoSlide.detachEvents(); swiperAutoSlide.destroy(true); swiperAutoSlide = undefined; $(".swiper-auto-width .swiper-wrapper").css("transform", "").css("transition-duration", ""); $(".swiper-auto-width .swiper-slide").css("margin-right", ""); setTimeout(function () { swiperAutoSlide = new Swiper('.swiper-auto-width', { scrollbar: '.swiper-scrollbar', scrollbarHide: false, scrollbarDraggable: true, slidesPerView: 'auto', centeredSlides: true, spaceBetween: 80, preventClicks: false, scrollbarSnapOnRelease: true, nextButton: '.swiper-next-style2', prevButton: '.swiper-prev-style2', mousewheelControl: true, speed: 1000, keyboardControl: true, breakpoints: { 1199: { spaceBetween: 60 }, 960: { spaceBetween: 30 }, 767: { spaceBetween: 15 } }, onSlideChangeEnd: function (swiper) { swiperAutoSlideIndex = swiper.activeIndex; } }); swiperAutoSlide.slideTo(swiperAutoSlideIndex, 1000, false); }, 1000); } }); /*============================================================== smooth scroll ==============================================================*/ var scrollAnimationTime = 1200, scrollAnimation = 'easeInOutExpo'; $(document).on('click.smoothscroll', 'a.scrollto', function (event) { event.preventDefault(); var target = this.hash; if ($(target).length != 0) { $('html, body').stop() .animate({ 'scrollTop': $(target) .offset() .top }, scrollAnimationTime, scrollAnimation, function () { window.location.hash = target; }); } }); /*============================================================== humburger menu one page navigation ==============================================================*/ if ($('.full-width-pull-menu').length > 0) { $(document).on('click', '.full-width-pull-menu .inner-link', function (e) { //$('body').removeClass('overflow-hidden position-fixed'); $(".full-width-pull-menu .close-button-menu").trigger("click"); var _this = $(this); setTimeout(function () { var target = _this.attr("href"); if ($(target).length > 0) { $('html, body').stop() .animate({ 'scrollTop': $(target).offset().top }); } }, 500); }); } // Inner links if ($('.navbar-top').length > 0 || $('.navbar-scroll-top').length > 0 || $('.nav-top-scroll').length > 0) { $('.inner-link').smoothScroll({ speed: 900, offset: 0 }); } else { $('.inner-link').smoothScroll({ speed: 900, offset: -59 }); } $('.section-link').smoothScroll({ speed: 900, offset: 1 }); /*==============================================================*/ //PieChart For Onepage - START CODE /*==============================================================*/ if ($('.chart1').length > 0) { $('.chart1').appear(); $('.chart1').easyPieChart({ barColor: '#929292', trackColor: '#d9d9d9', scaleColor: false, easing: 'easeOutBounce', scaleLength: 1, lineCap: 'round', lineWidth: 3, //12 size: 150, //110 animate: { duration: 2000, enabled: true }, onStep: function (from, to, percent) { $(this.el).find('.percent').text(Math.round(percent)); } }); $(document.body).on('appear', '.chart1', function (e) { // this code is executed for each appeared element if (!$(this).hasClass('appear')) { $(this).addClass('appear'); $(this).data('easyPieChart').update(0).update($(this).data('percent')); } }); } if ($('.chart2').length > 0) { $('.chart2').appear(); $('.chart2').easyPieChart({ easing: 'easeOutCirc', barColor: '#ff214f', trackColor: '#c7c7c7', scaleColor: false, scaleLength: 1, lineCap: 'round', lineWidth: 2, //12 size: 120, //110 animate: { duration: 2000, enabled: true }, onStep: function (from, to, percent) { $(this.el).find('.percent').text(Math.round(percent)); } }); $(document.body).on('appear', '.chart2', function (e) { // this code is executed for each appeared element if (!$(this).hasClass('appear')) { $(this).addClass('appear'); $(this).data('easyPieChart').update(0).update($(this).data('percent')); } }); } if ($('.chart3').length > 0) { $('.chart3').appear(); $('.chart3').easyPieChart({ easing: 'easeOutCirc', barColor: '#ff214f', trackColor: '', scaleColor: false, scaleLength: 1, lineCap: 'round', lineWidth: 3, //12 size: 140, //110 animate: { duration: 2000, enabled: true }, onStep: function (from, to, percent) { $(this.el).find('.percent').text(Math.round(percent)); } }); $(document.body).on('appear', '.chart3', function (e) { // this code is executed for each appeared element if (!$(this).hasClass('appear')) { $(this).addClass('appear'); $(this).data('easyPieChart').update(0).update($(this).data('percent')); } }); } /*==============================================================*/ //PieChart For Onepage - END CODE /*==============================================================*/ /*============================================================== portfolio filter ==============================================================*/ var $portfolio_filter = $('.portfolio-grid'); $portfolio_filter.imagesLoaded(function () { $portfolio_filter.isotope({ layoutMode: 'masonry', itemSelector: '.grid-item', percentPosition: true, masonry: { columnWidth: '.grid-sizer' } }); $portfolio_filter.isotope(); }); var $grid_selectors = $('.portfolio-filter > li > a'); $grid_selectors.on('click', function () { $grid_selectors.parent().removeClass('active'); $(this).parent().addClass('active'); var selector = $(this).attr('data-filter'); $portfolio_filter.find('.grid-item').removeClass('animated').css("visibility", ""); // avoid problem to filter after sorting $portfolio_filter.find('.grid-item').each(function () { /* remove perticular element from WOW array when you don't want animation on element after DOM lead */ wow.removeBox(this); $(this).css("-webkit-animation", "none"); $(this).css("-moz-animation", "none"); $(this).css("-ms-animation", "none"); $(this).css("animation", "none"); }); $portfolio_filter.isotope({filter: selector}); return false; }); $(window).resize(function () { if (!isMobile && !isiPhoneiPad) { setTimeout(function () { $portfolio_filter.find('.grid-item').removeClass('wow').removeClass('animated'); // avoid problem to filter after window resize $portfolio_filter.isotope('layout'); }, 300); } }); var $blog_filter = $('.blog-grid'); $blog_filter.imagesLoaded(function () { $blog_filter.isotope({ layoutMode: 'masonry', itemSelector: '.grid-item', percentPosition: true, masonry: { columnWidth: '.grid-sizer' } }); }); $(window).resize(function () { setTimeout(function () { $blog_filter.find('.grid-item').removeClass('wow').removeClass('animated'); // avoid problem to filter after window resize $blog_filter.isotope('layout'); }, 300); }); /*============================================================== lightbox gallery ==============================================================*/ $('.lightbox-gallery').magnificPopup({ delegate: 'a', type: 'image', tLoading: 'Loading image #%curr%...', mainClass: 'mfp-fade', fixedContentPos: true, closeBtnInside: false, gallery: { enabled: true, navigateByImgClick: true, preload: [0, 1] // Will preload 0 - before current, and 1 after the current image } }); /* for group gallery */ var lightboxgallerygroups = {}; $('.lightbox-group-gallery-item').each(function () { var id = $(this).attr('data-group'); if (!lightboxgallerygroups[id]) { lightboxgallerygroups[id] = []; } lightboxgallerygroups[id].push(this); }); $.each(lightboxgallerygroups, function () { $(this).magnificPopup({ type: 'image', closeOnContentClick: true, closeBtnInside: false, gallery: {enabled: true} }); }); $('.lightbox-portfolio').magnificPopup({ delegate: '.gallery-link', type: 'image', tLoading: 'Loading image #%curr%...', mainClass: 'mfp-fade', fixedContentPos: true, closeBtnInside: false, gallery: { enabled: true, navigateByImgClick: false, preload: [0, 1] // Will preload 0 - before current, and 1 after the current image } }); /*============================================================== single image lightbox - zoom animation ==============================================================*/ $('.single-image-lightbox').magnificPopup({ type: 'image', closeOnContentClick: true, fixedContentPos: true, closeBtnInside: false, mainClass: 'mfp-no-margins mfp-with-zoom', // class to remove default margin from left and right side image: { verticalFit: true }, zoom: { enabled: true, duration: 300 // don't foget to change the duration also in CSS } }); /*============================================================== zoom gallery ==============================================================*/ $('.zoom-gallery').magnificPopup({ delegate: 'a', type: 'image', mainClass: 'mfp-with-zoom mfp-img-mobile', fixedContentPos: true, closeBtnInside: false, image: { verticalFit: true, titleSrc: function (item) { return item.el.attr('title'); } }, gallery: { enabled: true }, zoom: { enabled: true, duration: 300, // don't foget to change the duration also in CSS opener: function (element) { return element.find('img'); } } }); /*==============================================================*/ //Modal popup - START CODE /*==============================================================*/ $('.modal-popup').magnificPopup({ type: 'inline', preloader: false, // modal: true, blackbg: true, callbacks: { open: function () { $('html').css('margin-right', 0); } } }); $(document).on('click', '.popup-modal-dismiss', function (e) { e.preventDefault(); $.magnificPopup.close(); }); /*==============================================================*/ //Modal popup - END CODE /*==============================================================*/ /*==============================================================*/ //Modal popup - zoom animation - START CODE /*==============================================================*/ $('.popup-with-zoom-anim').magnificPopup({ type: 'inline', fixedContentPos: false, fixedBgPos: true, overflowY: 'auto', closeBtnInside: true, preloader: false, midClick: true, removalDelay: 300, blackbg: true, mainClass: 'my-mfp-zoom-in' }); $('.popup-with-move-anim').magnificPopup({ type: 'inline', fixedContentPos: false, fixedBgPos: true, overflowY: 'auto', closeBtnInside: true, preloader: false, midClick: true, removalDelay: 300, blackbg: true, mainClass: 'my-mfp-slide-bottom' }); /*==============================================================*/ //Modal popup - zoom animation - END CODE /*==============================================================*/ /*============================================================== popup with form ==============================================================*/ $('.popup-with-form').magnificPopup({ type: 'inline', preloader: false, closeBtnInside: false, fixedContentPos: true, focus: '#name', callbacks: { beforeOpen: function () { if ($(window).width() < 700) { this.st.focus = false; } else { this.st.focus = '#name'; } } } }); /*============================================================== video magnific popup ==============================================================*/ $('.popup-youtube, .popup-vimeo, .popup-googlemap').magnificPopup({ disableOn: 700, type: 'iframe', mainClass: 'mfp-fade', removalDelay: 160, preloader: false, fixedContentPos: true, closeBtnInside: false }); /*============================================================== ajax magnific popup for onepage portfolio ==============================================================*/ $('.ajax-popup').magnificPopup({ type: 'ajax', alignTop: true, fixedContentPos: true, overflowY: 'scroll', // as we know that popup content is tall we set scroll overflow by default to avoid jump callbacks: { open: function () { $('.navbar .collapse').removeClass('in'); $('.navbar a.dropdown-toggle').addClass('collapsed'); } } }); /*============================================================== mega menu width ===============================================================*/ $("ul.mega-menu-full").each(function (idx, elm) { var megaMenuWidth = 0; $(this).children('li').each(function (idx, elm) { var LIheight = 0; console.log($(this).outerWidth()); megaMenuWidth += $(this).outerWidth(); }); $(this).width(megaMenuWidth + 95); megaMenuWidth = 0; }); /*============================================================== fit videos ==============================================================*/ $(".fit-videos").fitVids(); /*============================================================== form to email ==============================================================*/ $("#success-subscribe-newsletter").hide(); $("#success-subscribe-newsletter2").hide(); $("#success-contact-form").hide(); $("#success-project-contact-form").hide(); $("#success-contact-form-2").hide(); $("#success-contact-form-3").hide(); $("#success-project-contact-form-4").hide(); //Subscribe newsletter form $(document).on("click", '#button-subscribe-newsletter', function () { var error = ValidationsubscribenewsletterForm(); if (error) { $.ajax({ type: "POST", url: "email-templates/subscribe-newsletter.php", data: $("#subscribenewsletterform").serialize(), success: function (result) { // Un-comment below code to redirect user to thank you page. //window.location.href="thank-you.html"; $('input[type=text],textarea').each(function () { $(this).val(''); }); $("#success-subscribe-newsletter").html(result); $("#success-subscribe-newsletter").fadeIn("slow"); $('#success-subscribe-newsletter').delay(4000).fadeOut("slow"); } }); } }); function ValidationsubscribenewsletterForm() { var error = true; $('#subscribenewsletterform input[type=text]').each(function (index) { if (index == 0) { if (!(/(.+)@(.+){2,}\.(.+){2,}/.test($(this).val()))) { $("#subscribenewsletterform").find("input:eq(" + index + ")").addClass("required-error"); error = false; } else { $("#subscribenewsletterform").find("input:eq(" + index + ")").removeClass("required-error"); } } }); return error; } $(document).on("click", '#button-subscribe-newsletter2', function () { var error = ValidationsubscribenewsletterForm2(); if (error) { $.ajax({ type: "POST", url: "email-templates/subscribe-newsletter.php", data: $("#subscribenewsletterform2").serialize(), success: function (result) { // Un-comment below code to redirect user to thank you page. //window.location.href="thank-you.html"; $('input[type=text],textarea').each(function () { $(this).val(''); }); $("#success-subscribe-newsletter2").html(result); $("#success-subscribe-newsletter2").fadeIn("slow"); $('#success-subscribe-newsletter2').delay(4000).fadeOut("slow"); } }); } }); function ValidationsubscribenewsletterForm2() { var error = true; $('#subscribenewsletterform2 input[type=text]').each(function (index) { if (index == 0) { if (!(/(.+)@(.+){2,}\.(.+){2,}/.test($(this).val()))) { $("#subscribenewsletterform2").find("input:eq(" + index + ")").addClass("required-error"); error = false; } else { $("#subscribenewsletterform2").find("input:eq(" + index + ")").removeClass("required-error"); } } }); return error; } //Contact us form $(document).on("click", '#contact-us-button', function () { var error = ValidationContactForm(); if (error) { $.ajax({ type: "POST", url: "email-templates/contact.php", data: $("#contact-form").serialize(), success: function (result) { // Un-comment below code to redirect user to thank you page. //window.location.href="thank-you.html"; $('input[type=text],textarea').each(function () { $(this).val(''); }); $("#success-contact-form").html(result); $("#success-contact-form").fadeIn("slow"); $('#success-contact-form').delay(4000).fadeOut("slow"); } }); } }); function ValidationContactForm() { var error = true; $('#contact-form input[type=text]').each(function (index) { if (index == 0) { if ($(this).val() == null || $(this).val() == "") { $("#contact-form").find("input:eq(" + index + ")").addClass("required-error"); error = false; } else { $("#contact-form").find("input:eq(" + index + ")").removeClass("required-error"); } } else if (index == 1) { if (!(/(.+)@(.+){2,}\.(.+){2,}/.test($(this).val()))) { $("#contact-form").find("input:eq(" + index + ")").addClass("required-error"); error = false; } else { $("#contact-form").find("input:eq(" + index + ")").removeClass("required-error"); } } }); return error; } //Contact us form 2 $('#contact-us-button-2').on("click", function () { var error = ValidationContactForm2(); if (error) { $.ajax({ type: "POST", url: "email-templates/contact.php", data: $("#contact-form-2").serialize(), success: function (result) { // Un-comment below code to redirect user to thank you page. //window.location.href="thank-you.html"; $('input[type=text],textarea').each(function () { $(this).val(''); }); $("#success-contact-form-2").html(result); $("#success-contact-form-2").fadeIn("slow"); $('#success-contact-form-2').delay(4000).fadeOut("slow"); } }); } }); function ValidationContactForm2() { var error = true; $('#contact-form-2 input[type=text]').each(function (index) { if (index == 0) { if ($(this).val() == null || $(this).val() == "") { $("#contact-form-2").find("input:eq(" + index + ")").addClass("required-error"); error = false; } else { $("#contact-form-2").find("input:eq(" + index + ")").removeClass("required-error"); } } else if (index == 1) { if (!(/(.+)@(.+){2,}\.(.+){2,}/.test($(this).val()))) { $("#contact-form-2").find("input:eq(" + index + ")").addClass("required-error"); error = false; } else { $("#contact-form-2").find("input:eq(" + index + ")").removeClass("required-error"); } } }); return error; } //Contact us form 3 $(document).on("click", '#contact-us-button-3', function () { var error = ValidationContactForm3(); if (error) { $.ajax({ type: "POST", url: "email-templates/contact.php", data: $("#contact-form-3").serialize(), success: function (result) { // Un-comment below code to redirect user to thank you page. //window.location.href="thank-you.html"; $('input[type=text],textarea').each(function () { $(this).val(''); }); $("#success-contact-form-3").html(result); $("#success-contact-form-3").fadeIn("slow"); $('#success-contact-form-3').delay(4000).fadeOut("slow"); } }); } }); function ValidationContactForm3() { var error = true; $('#contact-form-3 input[type=text]').each(function (index) { if (index == 0) { if ($(this).val() == null || $(this).val() == "") { $("#contact-form-3").find("input:eq(" + index + ")").addClass("required-error"); error = false; } else { $("#contact-form-3").find("input:eq(" + index + ")").removeClass("required-error"); } } else if (index == 1) { if (!(/(.+)@(.+){2,}\.(.+){2,}/.test($(this).val()))) { $("#contact-form-3").find("input:eq(" + index + ")").addClass("required-error"); error = false; } else { $("#contact-form-3").find("input:eq(" + index + ")").removeClass("required-error"); } } }); return error; } //Project Contact us form $(document).on("click", '#project-contact-us-button', function () { var error = ValidationProjectContactForm(); if (error) { $.ajax({ type: "POST", url: "email-templates/project-contact.php", data: $("#project-contact-form").serialize(), success: function (result) { // Un-comment below code to redirect user to thank you page. //window.location.href="thank-you.html"; $('input[type=text],textarea').each(function () { $(this).val(''); }); $("#success-project-contact-form").html(result); $("#success-project-contact-form").fadeIn("slow"); $('#success-project-contact-form').delay(4000).fadeOut("slow"); } }); } }); function ValidationProjectContactForm() { var error = true; $('#project-contact-form input[type=text]').each(function (index) { if (index == 0) { if ($(this).val() == null || $(this).val() == "") { $("#project-contact-form").find("input:eq(" + index + ")").addClass("required-error"); error = false; } else { $("#project-contact-form").find("input:eq(" + index + ")").removeClass("required-error"); } } else if (index == 2) { if (!(/(.+)@(.+){2,}\.(.+){2,}/.test($(this).val()))) { $("#project-contact-form").find("input:eq(" + index + ")").addClass("required-error"); error = false; } else { $("#project-contact-form").find("input:eq(" + index + ")").removeClass("required-error"); } } }); return error; } //Project Contact us form 2 $(document).on("click", '#project-contact-us-4-button', function () { var error = ValidationProjectContactForm4(); if (error) { $.ajax({ type: "POST", url: "email-templates/project-contact.php", data: $("#project-contact-form-4").serialize(), success: function (result) { // Un-comment below code to redirect user to thank you page. //window.location.href="thank-you.html"; $('input[type=text],textarea').each(function () { $(this).val(''); }); $("#success-project-contact-form-4").html(result); $("#success-project-contact-form-4").fadeIn("slow"); $('#success-project-contact-form-4').delay(4000).fadeOut("slow"); } }); } }); function ValidationProjectContactForm4() { var error = true; $('#project-contact-form-4 input[type=text]').each(function (index) { if (index == 0) { if ($(this).val() == null || $(this).val() == "") { $("#project-contact-form-4").find("input:eq(" + index + ")").addClass("required-error"); error = false; } else { $("#project-contact-form-4").find("input:eq(" + index + ")").removeClass("required-error"); } } else if (index == 2) { if (!(/(.+)@(.+){2,}\.(.+){2,}/.test($(this).val()))) { $("#project-contact-form-4").find("input:eq(" + index + ")").addClass("required-error"); error = false; } else { $("#project-contact-form-4").find("input:eq(" + index + ")").removeClass("required-error"); } } }); return error; } /*============================================================== End form to email ==============================================================*/ /*============================================================== wow animation - on scroll ==============================================================*/ var wow = new WOW({ boxClass: 'wow', animateClass: 'animated', offset: 0, mobile: false, live: true }); $(window).imagesLoaded(function () { wow.init(); }); /*============================================================== counter ==============================================================*/ $(function ($) { animatecounters(); }); function animatecounters() { $('.timer').each(count); function count(options) { var $this = $(this); options = $.extend({}, options || {}, $this.data('countToOptions') || {}); $this.countTo(options); } } /* =================================== counter number reset while scrolling ====================================== */ $('.timer').appear(); $(document.body).on('appear', '.timer', function (e) { // this code is executed for each appeared element if (!$(this).hasClass('appear')) { animatecounters(); $(this).addClass('appear'); } }); $('.countdown').countdown($('.countdown').attr("data-enddate")).on('update.countdown', function (event) { $(this).html(event.strftime('' + '