(function($) { "use strict"; //Hide Loading Box (Preloader) function handlePreloader() { if($('.preloader').length){ $('.preloader').delay(200).fadeOut(500); } } //Update Header Style and Scroll to Top function headerStyle() { if($('.main-header').length){ var windowpos = $(window).scrollTop(); var siteHeader = $('.main-header'); var scrollLink = $('.scroll-to-top'); var sticky_header = $('.main-header .sticky-header, .main-header .mobile-sticky-header'); if (windowpos > 500) { siteHeader.addClass('fixed-header'); sticky_header.addClass('animated slideInDown'); scrollLink.fadeIn(300); } else{ siteHeader.removeClass('fixed-header'); sticky_header.removeClass('animated slideInDown'); scrollLink.fadeOut(300); } } } headerStyle(); // Open modal in AJAX callback $('#appointment-btn').on('click', function(event) { event.preventDefault(); this.blur(); $.get(this.href, function(html) { $(html).appendTo('body').modal({ clickClose: false, fadeDuration: 300, fadeDelay: 0.15, }); }); }); //sticky-header Hide Show if($('.sticky-header').length){ var stickyMenuContent = $('.main-header .main-box .nav-outer').html(); $('.sticky-header .main-box').append(stickyMenuContent); //Sidebar Cart $('.main-header .cart-btn, .mobile-header .cart-btn').on('click', function() { $('body').addClass('sidebar-cart-active'); }); //Menu Toggle Btn $('.main-header .cart-back-drop, .main-header .close-cart').on('click', function() { $('body').removeClass('sidebar-cart-active'); }); } // Theme Button layers if($('.theme-btn').length){ $(".btn-style-one,.btn-style-two,.btn-style-three,.btn-style-four") .append(' '); } // Title Icon Divider // SVG Code if($('.divider').length){ $(".divider").append(''); } // Mobile Navigation if($('#nav-mobile').length){ jQuery(function ($) { var $navbar = $('#navbar'); var $mobileNav = $('#nav-mobile'); $navbar .clone() .removeClass('navbar') .appendTo($mobileNav); $mobileNav.mmenu({ "counters": false, "navbars": [ { "position": "top", "content": [ "prev", "title" ] }, { "position": "bottom", "content": [ "", "", "", "", ] } ], "extensions": [ "theme-dark" ], offCanvas: { position: 'left', zposition: 'front', } }); }); } //Banner Carousel if ($('.banner-carousel').length) { $('.banner-carousel').owlCarousel({ animateOut: 'fadeOut', animateIn: 'fadeIn', loop:true, margin:0, nav:true, smartSpeed: 500, autoHeight: true, autoplay: true, autoplayTimeout:5000, navText: [ '', '' ], responsive:{ 0:{ items:1 }, 600:{ items:1 }, 1024:{ items:1 }, } }); } //Services Carousel if ($('.services-carousel').length) { $('.services-carousel').owlCarousel({ loop:true, margin:0, nav:true, smartSpeed: 700, autoplayTimeout:10000, autoplay: false, navText: [ '', '' ], responsive:{ 0:{ items:1 }, 768:{ items:2 }, 1024:{ items:3 } } }); } //Single Item Carousel if ($('.single-item-carousel').length) { $('.single-item-carousel').owlCarousel({ loop:true, margin:30, nav:true, item:1, smartSpeed: 500, autoHeight: true, autoplay: true, autoplayTimeout:10000, navText: [ '', '' ], responsive:{ 0:{ items:1 }, 768:{ items:1 }, 1024:{ items:1 } } }); } //Three Items Carousel if ($('.three-items-carousel').length) { $('.three-items-carousel').owlCarousel({ loop:true, margin:22, nav:true, smartSpeed: 400, autoplay: true, navText: [ '', '' ], responsive:{ 0:{ items:1 }, 600:{ items:1 }, 768:{ items:2 }, 1366:{ items:3 } } }); } //Four Items Carousel if ($('.four-items-carousel').length) { $('.four-items-carousel').owlCarousel({ loop:true, margin:22, nav:true, smartSpeed: 400, autoplay: true, navText: [ '', '' ], responsive:{ 0:{ items:1 }, 600:{ items:1 }, 768:{ items:2 }, 1366:{ items:3 }, 1600:{ items:4 } } }); } //Clients Carousel if ($('.clients-carousel').length) { $('.clients-carousel').owlCarousel({ loop:true, margin:30, nav:true, smartSpeed: 400, autoplay: true, navText: [ '', '' ], responsive:{ 0:{ items:1 }, 480:{ items:2 }, 600:{ items:3 }, 768:{ items:4 }, 1280:{ items:5 } } }); } //Client Testimonial Carousel if ($('.client-testimonial-carousel').length && $('.client-thumbs-carousel').length) { var $sync3 = $(".client-testimonial-carousel"), $sync4 = $(".client-thumbs-carousel"), flag = false, duration = 500; $sync3 .owlCarousel({ loop:true, items: 1, margin: 0, nav: true, navText: [ '', '' ], dots: true, autoplay: true, autoplayTimeout: 5000 }) .on('changed.owl.carousel', function (e) { if (!flag) { flag = false; $sync4.trigger('to.owl.carousel', [e.item.index, duration, true]); flag = false; } }); $sync4 .owlCarousel({ loop:true, margin:0, items: 1, nav: false, navText: [ '', '' ], dots: false, center: true, autoplay: true, autoplayTimeout: 5000, responsive: { 0:{ items:1, autoWidth: false }, 400:{ items:1, autoWidth: false }, 600:{ items:1, autoWidth: false }, 1000:{ items:1, autoWidth: false }, 1200:{ items:1, autoWidth: false } }, }) .on('click', '.owl-item', function () { $sync3.trigger('to.owl.carousel', [$(this).index(), duration, true]); }) .on('changed.owl.carousel', function (e) { if (!flag) { flag = true; $sync3.trigger('to.owl.carousel', [e.item.index, duration, true]); flag = false; } }); } //Testimonial Carousel Two if ($('.testimonial-carousel-two').length) { $('.testimonial-carousel-two').owlCarousel({ loop:true, margin:0, nav:true, smartSpeed: 700, autoplay: true, navText: [ '', '' ], responsive:{ 0:{ items:1 }, 600:{ items:1 }, 1024:{ items:2 }, } }); } //Default Masonary function defaultMasonry() { if($('.masonry-items-container').length){ var winDow = $(window); // Needed variables var $container=$('.masonry-items-container'); $container.isotope({ itemSelector: '.masonry-item', masonry: { columnWidth : '.masonry-item' }, animationOptions:{ duration:500, easing:'linear' } }); winDow.on('resize', function(){ $container.isotope({ itemSelector: '.masonry-item', animationOptions: { duration: 500, easing : 'linear', queue : false } }); }); } } defaultMasonry(); //MixItup Gallery if($('.filter-list').length){ $('.filter-list').mixItUp(); } //Jquery Spinner / Quantity Spinner if($('.quantity-spinner').length){ $("input.quantity-spinner").TouchSpin({ verticalbuttons: true }); } //Header Search if($('.search-btn').length) { $('.search-btn').on('click', function() { $('.main-header').addClass('moblie-search-active'); }); $('.close-search, .search-back-drop').on('click', function() { $('.main-header').removeClass('moblie-search-active'); }); } //Coming Soon Coundown. if($('.cs-countdown').length){ $(function(){ $('[data-countdown]').each(function() { var $this = $(this), finalDate = $(this).data('countdown'); $this.countdown(finalDate, function(event) { $this.html(even.tstrftime('%D days %H:%M:%S')); }); }); }); $('.cs-countdown').countdown('').on('update.countdown', function(event) { var $this = $(this).html(event.strftime('
%D
days
%H
Hours
%M
Minutes
%S
Seconds
')); }); } //Message Box if($('.message-box').length){ $('.message-box .close-btn').on('click', function(e) { $(this).parent('.message-box').fadeOut(); }); } //Accordion Box if($('.accordion-box').length){ $(".accordion-box").on('click', '.acc-btn', function() { var outerBox = $(this).parents('.accordion-box'); var target = $(this).parents('.accordion'); if($(this).hasClass('active')!==true){ $(outerBox).find('.accordion .acc-btn').removeClass('active '); } if ($(this).next('.acc-content').is(':visible')){ return false; }else{ $(this).addClass('active'); $(outerBox).children('.accordion').removeClass('active-block'); $(outerBox).find('.accordion').children('.acc-content').slideUp(300); target.addClass('active-block'); $(this).next('.acc-content').slideDown(300); } }); } //Fact Counter + Text Count if($('.count-box').length){ $('.count-box').appear(function(){ var $t = $(this), n = $t.find(".count-text").attr("data-stop"), r = parseInt($t.find(".count-text").attr("data-speed"), 10); if (!$t.hasClass("counted")) { $t.addClass("counted"); $({ countNum: $t.find(".count-text").text() }).animate({ countNum: n }, { duration: r, easing: "linear", step: function() { $t.find(".count-text").text(Math.floor(this.countNum)); }, complete: function() { $t.find(".count-text").text(this.countNum); } }); } },{accY: 0}); } //Progress Bar if($('.progress-line').length){ $('.progress-line').appear(function(){ var el = $(this); var percent = el.data('width'); $(el).css('width',percent+'%'); },{accY: 0}); } //Tabs Box if($('.tabs-box').length){ $('.tabs-box .tab-buttons .tab-btn').on('click', function(e) { e.preventDefault(); var target = $($(this).attr('data-tab')); if ($(target).is(':visible')){ return false; }else{ target.parents('.tabs-box').find('.tab-buttons').find('.tab-btn').removeClass('active-btn'); $(this).addClass('active-btn'); target.parents('.tabs-box').find('.tabs-content').find('.tab').fadeOut(0); target.parents('.tabs-box').find('.tabs-content').find('.tab').removeClass('active-tab animated fadeIn'); $(target).fadeIn(300); $(target).addClass('active-tab animated fadeIn'); } }); } //LightBox / Fancybox if($('.lightbox-image').length) { $('.lightbox-image').fancybox({ openEffect : 'fade', closeEffect : 'fade', helpers : { media : {} } }); } //Contact Form Validation if($('#email-form').length){ $('#submit').click(function(){ var o = new Object(); var form = '#email-form'; var username = $('#email-form .username').val(); var email = $('#email-form .email').val(); var subject = $('#email-form .subject').val(); if(username == '' || email == '' || subject == '') { $('#email-form .response').html('
Please fill the required fields.
'); return false; } $.ajax({ url:"sendemail.php", method:"POST", data: $(form).serialize(), beforeSend:function(){ $('#email-form .response').html('
Loading...
'); }, success:function(data){ $('form').trigger("reset"); $('#email-form .response').fadeIn().html(data); setTimeout(function(){ $('#email-form .response').fadeOut("slow"); }, 5000); }, error:function(){ $('#email-form .response').fadeIn().html(data); } }); }); } // Scroll to a Specific Div if($('.scroll-to-target').length){ $(".scroll-to-target").on('click', function() { var target = $(this).attr('data-target'); // animate $('html, body').animate({ scrollTop: $(target).offset().top }, 1500); }); } // Elements Animation if($('.wow').length){ var wow = new WOW( { boxClass: 'wow', // animated element css class (default is wow) animateClass: 'animated', // animation css class (default is animated) offset: 0, // distance to the element when triggering the animation (default is 0) mobile: false, // trigger animations on mobile devices (default is true) live: true // act on asynchronously loaded content (default is true) } ); wow.init(); } //Event Countdown Timer if($('.time-countdown').length){ $('.time-countdown').each(function() { var $this = $(this), finalDate = $(this).data('countdown'); $this.countdown(finalDate, function(event) { var $this = $(this).html(event.strftime('' + '
%DDays
' + '
%HHours
' + '
%MMinutes
' + '
%SSeconds
')); }); }); } if($('.clock-wrapper').length){ (function(){ //generate clock animations var now = new Date(), hourDeg = now.getHours() / 12 * 360 + now.getMinutes() / 60 * 30, minuteDeg = now.getMinutes() / 60 * 360 + now.getSeconds() / 60 * 6, secondDeg = now.getSeconds() / 60 * 360, stylesDeg = [ "@-webkit-keyframes rotate-hour{from{transform:rotate(" + hourDeg + "deg);}to{transform:rotate(" + (hourDeg + 360) + "deg);}}", "@-webkit-keyframes rotate-minute{from{transform:rotate(" + minuteDeg + "deg);}to{transform:rotate(" + (minuteDeg + 360) + "deg);}}", "@-webkit-keyframes rotate-second{from{transform:rotate(" + secondDeg + "deg);}to{transform:rotate(" + (secondDeg + 360) + "deg);}}", "@-moz-keyframes rotate-hour{from{transform:rotate(" + hourDeg + "deg);}to{transform:rotate(" + (hourDeg + 360) + "deg);}}", "@-moz-keyframes rotate-minute{from{transform:rotate(" + minuteDeg + "deg);}to{transform:rotate(" + (minuteDeg + 360) + "deg);}}", "@-moz-keyframes rotate-second{from{transform:rotate(" + secondDeg + "deg);}to{transform:rotate(" + (secondDeg + 360) + "deg);}}" ].join(""); document.getElementById("clock-animations").innerHTML = stylesDeg; })(); } /* ========================================================================== When document is Scrollig, do ========================================================================== */ $(window).on('scroll', function() { headerStyle(); }); /* ========================================================================== When document is loading, do ========================================================================== */ $(window).on('load', function() { handlePreloader(); defaultMasonry(); }); })(window.jQuery);