(function ($) { "use strict"; var $window = $(window); var $body = $('body'); /* Preloader Effect */ $window.on('load', function(){ $(".preloader").fadeOut(600); }); /* Sticky Header */ if($('.active-sticky-header').length){ $window.on('resize', function(){ setHeaderHeight(); }); function setHeaderHeight(){ $("header.active-sticky-header").css("height", $('header.active-sticky-header .header-sticky').outerHeight()); } $window.on("scroll", function() { var fromTop = $(window).scrollTop(); setHeaderHeight(); var headerHeight = $('header.active-sticky-header .header-sticky').outerHeight() $("header.active-sticky-header .header-sticky").toggleClass("hide", (fromTop > headerHeight + 100)); $("header.active-sticky-header .header-sticky").toggleClass("active", (fromTop > 600)); }); } /* Slick Menu JS */ $('#menu').slicknav({ label : '', prependTo : '.responsive-menu' }); if($("a[href='#top']").length){ $(document).on("click", "a[href='#top']", function() { $("html, body").animate({ scrollTop: 0 }, "slow"); return false; }); } /* testimonial Slider JS */ if ($('.testimonial-slider').length) { const testimonial_slider = new Swiper('.testimonial-slider .swiper', { slidesPerView : 1, speed: 1500, spaceBetween: 30, loop: true, autoplay: { delay: 5000, }, pagination: { el: '.testimonial-pagination', clickable: true, }, breakpoints: { 768:{ slidesPerView: 2, }, 1025:{ slidesPerView: 3, }, } }); } /* testimonial Slider Elite JS */ if ($('.testimonial-slider-elite').length) { const testimonial_slider = new Swiper('.testimonial-slider-elite .swiper', { slidesPerView : 1, speed: 1500, spaceBetween: 30, loop: true, autoplay: { delay: 5000, }, pagination: { el: '.testimonial-pagination', clickable: true, }, breakpoints: { 768:{ slidesPerView: 2, }, 1025:{ slidesPerView: 3, }, } }); } /* Company Support Slider Eliet JS */ if ($('.company-supports-slider-elite').length) { const company_supports_slider_elite = new Swiper('.company-supports-slider-elite .swiper', { slidesPerView : 2, speed: 2000, spaceBetween: 20, loop: true, autoplay: { delay: 5000, }, breakpoints: { 767:{ slidesPerView: 4, }, 1025:{ slidesPerView: 5, } } }); } /* testimonial Slider Prime JS */ if ($('.testimonial-slider-prime').length) { const testimonial_slider = new Swiper('.testimonial-slider-prime .swiper', { slidesPerView : 1, speed: 1500, spaceBetween: 30, loop: true, autoplay: { delay: 5000, }, pagination: { el: '.testimonial-pagination-prime', clickable: true, }, breakpoints: { 767:{ slidesPerView: 1, }, 990:{ slidesPerView: 2, }, 1025:{ slidesPerView: 2, }, } }); } /* Company Support Slider JS */ if ($('.company-supports-slider-prime').length) { const company_supports_slider_prime= new Swiper('.company-supports-slider-prime .swiper', { slidesPerView : 2, speed: 2000, spaceBetween: 20, loop: true, autoplay: { delay: 5000, }, breakpoints: { 767:{ slidesPerView: 4, }, 1025:{ slidesPerView: 5, } } }); } /* Progress Bar */ if ($('.circle').length){ $('.circle').each(function() { var el = $(this).circleProgress({value: 0}); var rawValue = $(this).data('value'); var progressValue = rawValue >= 1 ? 1 : rawValue; var progressBarOptions = { startAngle: -1.6, thickness: 4, fill: { color: window.getComputedStyle($(this)[0]).color } }; new Waypoint({ element: el.get(0), handler: function() { // Initialize the progress bar el.circleProgress($.extend({}, progressBarOptions, { value: el.data('value') })).on('circle-animation-progress', function(event, progress, stepValue) { var displayValue = Math.round(stepValue * 100); $(this).find('.progress_value .pro_data').text(displayValue); }); this.destroy(); }, offset: '80%' }); }); } /* Skill Bar */ if ($('.skills-progress-bar').length) { $('.skills-progress-bar').waypoint(function() { $('.skillbar').each(function() { $(this).find('.count-bar').animate({ width:$(this).attr('data-percent') },2000); }); },{ offset: '70%' }); } /* Youtube Background Video JS */ if ($('#herovideo').length) { var myPlayer = $("#herovideo").YTPlayer(); } /* Init Counter */ if ($('.counter').length) { $('.counter').counterUp({ delay: 6, time: 3000 }); } /* Image Reveal Animation */ if ($('.reveal').length) { gsap.registerPlugin(ScrollTrigger); let revealContainers = document.querySelectorAll(".reveal"); revealContainers.forEach((container) => { let image = container.querySelector("img"); let tl = gsap.timeline({ scrollTrigger: { trigger: container, toggleActions: "play none none none" } }); tl.set(container, { autoAlpha: 1 }); tl.from(container, 1, { xPercent: -100, ease: Power2.out }); tl.from(image, 1, { xPercent: 100, scale: 1, delay: -1, ease: Power2.out }); }); } /* Parallaxie js */ var $parallaxie = $('.parallaxie'); if($parallaxie.length && ($window.width() > 1024)) { if ($window.width() > 768) { $parallaxie.parallaxie({ speed: 0.55, offset: 0, }); } } /* Zoom Gallery screenshot */ $('.gallery-items').magnificPopup({ delegate: 'a', type: 'image', closeOnContentClick: false, closeBtnInside: false, mainClass: 'mfp-with-zoom', image: { verticalFit: true, }, 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'); } } }); /* Contact form validation */ var $contactform = $("#contactForm"); $contactform.validator({focus: false}).on("submit", function (event) { if (!event.isDefaultPrevented()) { event.preventDefault(); submitForm(); } }); function submitForm(){ /* Ajax call to submit form */ $.ajax({ type: "POST", url: "form-process.php", data: $contactform.serialize(), success : function(text){ if (text === "success"){ formSuccess(); } else { submitMSG(false,text); } } }); } function formSuccess(){ $contactform[0].reset(); submitMSG(true, "Message Sent Successfully!") } function submitMSG(valid, msg){ if(valid){ var msgClasses = "h4 text-success"; } else { var msgClasses = "h4 text-danger"; } $("#msgSubmit").removeClass().addClass(msgClasses).text(msg); } /* Contact form validation end */ /* Appointment form validation */ var $appointmentForm = $("#appointmentForm"); $appointmentForm.validator({focus: false}).on("submit", function (event) { if (!event.isDefaultPrevented()) { event.preventDefault(); submitappointmentForm(); } }); function submitappointmentForm(){ /* Ajax call to submit form */ $.ajax({ type: "POST", url: "form-appointment.php", data: $appointmentForm.serialize(), success : function(text){ if (text === "success"){ appointmentformSuccess(); } else { appointmentsubmitMSG(false,text); } } }); } function appointmentformSuccess(){ $appointmentForm[0].reset(); appointmentsubmitMSG(true, "Message Sent Successfully!") } function appointmentsubmitMSG(valid, msg){ if(valid){ var msgClasses = "h3 text-success"; } else { var msgClasses = "h3 text-danger"; } $("#msgSubmit").removeClass().addClass(msgClasses).text(msg); } /* Appointment form validation end */ /* Animated Wow Js */ new WOW().init(); /* Popup Video */ if ($('.popup-video').length) { $('.popup-video').magnificPopup({ type: 'iframe', mainClass: 'mfp-fade', removalDelay: 160, preloader: false, fixedContentPos: true }); } })(jQuery);