(function($) { "use strict"; //Hide Loading Box (Preloader) function handlePreloader() { if($('.preloader').length){ $('.preloader').delay(0).fadeOut(0); } } // Mobile Navigation function mobileNavToggler () { if ($('header .mainmenu-container').length) { $('header button.mainmenu-toggler').on('click', function () { $('ul.mainmenu').slideToggle(); return false; }); $('.mainmenu-container ul li.dropdown').append(function () { return ''; }); $('.mainmenu-container ul li.dropdown .fa').on('click', function () { $(this).parent('li').children('ul').slideToggle(); }); } } if($('.main-header li.dropdown .submenu').length){ $('.main-header li.dropdown').append(''); //Dropdown Button $('.main-header li.dropdown .dropdown-btn').on('click', function() { $(this).prev('.submenu').slideToggle(500); }); } //Update Header Style + Scroll to Top function headerStyle() { if($('.main-header').length){ var topHeader = $('.header-top').innerHeight(); var windowpos = $(window).scrollTop(); if (windowpos >= topHeader+50) { $('.main-header').addClass('fixed-top-header'); $('.scroll-to-top').fadeIn(300); } else { $('.main-header').removeClass('fixed-top-header'); $('.scroll-to-top').fadeOut(300); } } } //Update Header Style + Scroll to Top function scrollToTop() { if($('.page-wrapper').length){ var topHeader = $('.header-top').innerHeight(); var windowpos = $(window).scrollTop(); if (windowpos >= topHeader) { $('.page-wrapper').addClass('fixed-header'); $('.scroll-to-top').fadeIn(300); } else { $('.page-wrapper').removeClass('fixed-header'); $('.scroll-to-top').fadeOut(300); } } } //Main Slider if($('.main-slider .tp-banner').length){ jQuery('.main-slider .tp-banner').show().revolution({ delay:10000, startwidth:1170, startheight:820, hideThumbs:600, thumbWidth:80, thumbHeight:50, thumbAmount:5, navigationType:"bullet", navigationArrows:"0", navigationStyle:"preview4", touchenabled:"on", onHoverStop:"off", swipe_velocity: 0.7, swipe_min_touches: 1, swipe_max_touches: 1, drag_block_vertical: false, parallax:"mouse", parallaxBgFreeze:"on", parallaxLevels:[7,4,3,2,5,4,3,2,1,0], keyboardNavigation:"off", navigationHAlign:"center", navigationVAlign:"bottom", navigationHOffset:0, navigationVOffset:20, soloArrowLeftHalign:"left", soloArrowLeftValign:"center", soloArrowLeftHOffset:20, soloArrowLeftVOffset:0, soloArrowRightHalign:"right", soloArrowRightValign:"center", soloArrowRightHOffset:20, soloArrowRightVOffset:0, shadow:0, fullWidth:"on", fullScreen:"off", spinner:"spinner4", stopLoop:"off", stopAfterLoops:-1, stopAtSlide:-1, shuffle:"off", autoHeight:"off", forceFullWidth:"on", hideThumbsOnMobile:"on", hideNavDelayOnMobile:1500, hideBulletsOnMobile:"on", hideArrowsOnMobile:"on", hideThumbsUnderResolution:0, hideSliderAtLimit:0, hideCaptionAtLimit:0, hideAllCaptionAtLilmit:0, startWithSlide:0, videoJsPath:"", fullScreenOffsetContainer: ".main-slider" }); } //Adjust Footer Background function footerStyle() { if($('.main-footer .contact-widget').length){ var contactWidth = $('.main-footer .contact-widget').innerWidth(); //var windowWidth = $(window).width(); var contWidth = $('.main-footer .auto-container').width(); $('.main-footer .footer-bg-layer').css({'width':contWidth-contactWidth+15}); } } //Date TimePicker if($('.date-field').length) { $('.date-field').datepick(); } //Tabs Box if($('.tab-style').length){ $('.tab-style .tab-btn').on('click', function(e) { e.preventDefault(); var target = $($(this).attr('href')); $('.tab-style .tab-btn').removeClass('active'); $(this).addClass('active'); $('.tab-style .tab').fadeOut(0); $('.tab-style .tab').removeClass('active-tab'); $(target).fadeIn(300); $(target).addClass('active-tab'); var windowWidth = $(window).width(); if (windowWidth <= 700) { $('html, body').animate({ scrollTop: $('.tab-style .content-column').offset().top-100 }, 1000); } }); } // Owl Carousel function load_owlCarousel() { $('.gallery-carousel').owlCarousel({ loop:true, margin:5, dots: false, nav : true, navText: [ "", "" ], autoplayHoverPause:false, autoplay: 5000, smartSpeed: 700, responsive:{ 0:{ items:1 }, 600:{ items:1 }, 800:{ items:2 }, 1024:{ items:4 }, 1100:{ items:4 } } }); $('.testimonials-carousel').owlCarousel({ loop:true, margin:30, dots: true, nav : false, autoplayHoverPause:false, autoplay: 5000, smartSpeed: 700, responsive:{ 0:{ items:1 }, 600:{ items:2 }, 800:{ items:2 }, 1024:{ items:2 }, 1100:{ items:3 } } }); $('.sponsors-section .slider').owlCarousel({ loop:true, margin:20, nav:true, autoplay: 5000, responsive:{ 0:{ items:1 }, 600:{ items:2 }, 700:{ items:3 }, 1024:{ items:4 }, 1100:{ items:5 } } }); $('.feautered-videos-carousel').each(function() { var data_dots = ( $(this).data("dots") === undefined ) ? false: $(this).data("dots"); var data_nav = ( $(this).data("nav") === undefined ) ? false: $(this).data("nav"); $(this).owlCarousel({ autoplay: false, autoplayTimeout: 4000, loop: false, autoWidth:true, lazyLoad:true, margin: 15, scrollPerPage : true, dots: data_dots, nav: data_nav, navText: [ '', '' ], responsive: { 0: { items: 1, center: false, }, 600: { items: 1, center: false }, 750: { items: 3, center: false }, 960: { items: 3 }, 1170: { items: 7 }, 1300: { items: 8 } } }); }); } // Event slider function load_bxgallerySlider () { $('.widget-bxslider').bxSlider({ auto: false, speed: 300, mode: 'vertical', minSlides: 4, slideMargin: 30, pager: false, prevText: '', nextText: '' }); } //Skill Progress Bar if($('.skill-box .bar-fill').length){ $(".skill-box .bar-fill").each(function() { var progressWidth = $(this).attr('data-percent'); $(this).css('width',progressWidth+'%'); $(this).parents('.bar').children('.percent').html(progressWidth+'%'); }); } //Common CssJs $('[data-mt]').each(function() { $(this).css('margin-top', $(this).data("mt")); }); $('[data-bac]').each(function() { $(this).css("cssText", "background: " + $(this).data("bac") + " !important;"); }); $('[data-img-bg]').each(function() { $(this).css('background-image', 'url(' + $(this).data("img-bg") + ')'); }); $('[data-border]').each(function() { $(this).css('border', $(this).data("border")); }); $('[data-border-bottom]').each(function() { $(this).css('border-bottom', $(this).data("border-bottom")); }); $('[data-border-top]').each(function() { $(this).css('border-top', $(this).data("border-top")); }); $('[data-tc]').each(function() { $(this).css('color', $(this).data("tc")); }); $('[data-height]').each(function() { $(this).css('height', $(this).data("height")); }); // Fact Counter function factCounter() { if($('.fact-counter').length){ $('.fact-counter .column.animated').each(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); } }); } }); } } //Accordions if($('.accordion-box').length){ $('.accordion-box .acc-btn').on('click', function() { if($(this).hasClass('active')!==true){ $('.accordion-box .acc-btn').removeClass('active'); } if ($(this).next('.acc-content').is(':visible')){ $(this).removeClass('active'); $(this).next('.acc-content').slideUp(500); } else{ $(this).addClass('active'); $('.accordion-box .acc-content').slideUp(500); $(this).next('.acc-content').slideDown(500); } }); } // GalleryMasonaryLayout function galleryMasonaryLayout () { if ($('.img-masonary').length) { $('.img-masonary').isotope({ layoutMode:'masonry' }); } } // LightBox / Fancybox if($('.lightbox-image').length) { $('.lightbox-image').fancybox({ openEffect : 'elastic', closeEffect : 'elastic', helpers : { media : {} } }); } // Gallery Filters if($('.filter-list').length){ $('.filter-list').mixItUp({}); } //Contact Form Validation if($('#contact-form').length){ $('#contact-form').validate({ rules: { username: { required: true }, email: { required: true, email: true }, subject: { required: true }, message: { required: true } } }); } // Google Map Settings if($('#map-location').length){ var map; map = new GMaps({ el: '#map-location', zoom: 14, scrollwheel:false, //Set Latitude and Longitude Here lat: -37.817085, lng: 144.955631 }); //Add map Marker map.addMarker({ lat: -37.817085, lng: 144.955631, infoWindow: { content: '

Envato
Melbourne VIC 3000, Australia

' } }); } // Scroll to top if($('.scroll-to-top').length){ $(".scroll-to-top").on('click', function() { // animate $('html, body').animate({ scrollTop: $('html, body').offset().top }, 1000); }); } // 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: true, // trigger animations on mobile devices (default is true) live: true // act on asynchronously loaded content (default is true) } ); wow.init(); } // scrolling navigation function scrollingNav () { if ($('body.home-one-page-version').length) { // $('.mainmenu-container ul > li').each(function () { // $(this).addClass('scroll'); // }); $('.mainmenu-container .mainmenu > li > a').click(function() { $('.mainmenu-container .mainmenu > li > a').parent().removeClass('current'); $(this).parent().addClass('current'); $('html, body').animate({scrollTop: $(this.hash).offset().top -60}, 1000); return false; }); }; } // User define function function ScrollToActiveMenu () { var scrollPosition = $(document).scrollTop(); $('.mainmenu-container .mainmenu > a').each(function () { var currentLink = $(this); var refElement = $(currentLink.attr("href")); console.log(refElement); if (refElement.position().top-80 <= scrollPosition) { $('.mainmenu-container ul li.mainmenu > a').parent().removeClass("current"); currentLink.parent().addClass("current"); } else{ currentLink.parent().removeClass("current"); } }); } /* ========================================================================== When document is ready, do ========================================================================== */ $(document).on('ready', function() { headerStyle(); mobileNavToggler(); footerStyle(); scrollingNav(); }); /* ========================================================================== When document is Scrollig, do ========================================================================== */ $(window).on('scroll', function() { headerStyle(); factCounter(); galleryMasonaryLayout(); ScrollToActiveMenu(); }); /* ========================================================================== When document is loading, do ========================================================================== */ $(window).on('load', function() { handlePreloader(); load_owlCarousel(); load_bxgallerySlider(); galleryMasonaryLayout(); }); /* ========================================================================== When Window is resizing, do ========================================================================== */ $(window).on('resize', function() { footerStyle(); }); })(window.jQuery);