(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'); if (windowpos >= 200) { siteheader.addclass('fixed-header'); scrolllink.fadein(300); } else { siteheader.removeclass('fixed-header'); scrolllink.fadeout(300); } } } headerstyle(); //submenu dropdown toggle if($('.main-header .navigation li.dropdown ul').length){ $('.main-header .navigation li.dropdown').append(''); //dropdown button $('.main-header .navigation li.dropdown .dropdown-btn').on('click', function() { $(this).prev('ul').slidetoggle(500); }); //disable dropdown parent link //$('.navigation li.dropdown > a').on('click', function(e) { //e.preventdefault(); //}); } //hidden bar menu config function hiddenbarmenuconfig() { var menuwrap = $('.hidden-bar .side-menu'); // hidding submenu menuwrap.find('.dropdown').children('ul').hide(); // toggling child ul menuwrap.find('li.dropdown > a').each(function () { $(this).on('click', function (e) { e.preventdefault(); $(this).parent('li.dropdown').children('ul').slidetoggle(); // adding class to item container $(this).parent().toggleclass('open'); return false; }); }); } hiddenbarmenuconfig(); //hidden sidebar if ($('.hidden-bar').length) { var hiddenbar = $('.hidden-bar'); var hiddenbaropener = $('.hidden-bar-opener'); var hiddenbarcloser = $('.hidden-bar-closer'); $('.hidden-bar-wrapper').mcustomscrollbar(); //show sidebar hiddenbaropener.on('click', function () { hiddenbar.addclass('visible-sidebar'); }); //hide sidebar hiddenbarcloser.on('click', function () { hiddenbar.removeclass('visible-sidebar'); }); } //revolution slider if($('.main-slider .tp-banner').length){ var mainslider = $('.main-slider'); var strtheight = mainslider.attr('data-start-height'); var slideoverlay = "'"+ mainslider.attr('data-slide-overlay') +"'"; $('.main-slider .tp-banner').show().revolution({ dottedoverlay: slideoverlay, delay:10000, startwidth:1920, startheight:strtheight, 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:40, soloarrowlefthalign:"left", soloarrowleftvalign:"center", soloarrowlefthoffset:20, soloarrowleftvoffset:20, soloarrowrighthalign:"right", soloarrowrightvalign:"center", soloarrowrighthoffset:20, soloarrowrightvoffset:20, 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: "" }); } // fact counter function factcounter() { if($('.fact-counter').length){ $('.fact-counter .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); } }); } }); } } //progress bar / levels if($('.progress-levels .progress-box .bar-fill').length){ $(".progress-box .bar-fill").each(function() { var progresswidth = $(this).attr('data-percent'); $(this).css('width',progresswidth+'%'); $(this).children('.percent').html(progresswidth+'%'); }); } //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'); $(target).fadein(300); $(target).addclass('active-tab'); } }); } //sponsors carousel if ($('.sponsors-carousel').length) { $('.sponsors-carousel').owlcarousel({ loop:true, margin:0, nav:true, pagination:true, smartspeed: 700, autoplay: 4000, navtext: [ '', '' ], responsive:{ 0:{ items:1 }, 600:{ items:2 }, 800:{ items:3 }, 1200:{ items:4 } } }); } //single item slider if ($('.single-item-carousel').length) { $('.single-item-carousel').owlcarousel({ animatein: 'fadein', animateout: 'fadeout', loop:true, margin:0, nav:true, pagination:true, smartspeed: 700, autoplay: 4000, navtext: [ '', '' ], responsive:{ 0:{ items:1 }, 600:{ items:1 }, 800:{ items:1 }, 1200:{ items:1 } } }); } //two item slider if ($('.two-item-carousel').length) { $('.two-item-carousel').owlcarousel({ loop:true, margin:40, nav:true, pagination:true, smartspeed: 700, autoplay: 4000, navtext: [ '', '' ], responsive:{ 0:{ items:1 }, 600:{ items:2 }, 800:{ items:2 }, 1200:{ items:2 } } }); } //lightbox / fancybox if($('.lightbox-image').length) { $('.lightbox-image').fancybox({ openeffect : 'fade', closeeffect : 'fade', helpers : { media : {} } }); } //mixitup gallery 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 } } }); } // 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 }, 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: false, // trigger animations on mobile devices (default is true) live: true // act on asynchronously loaded content (default is true) } ); wow.init(); } /* ========================================================================== when document is scrollig, do ========================================================================== */ $(window).on('scroll', function() { headerstyle(); factcounter(); }); /* ========================================================================== when document is loaded, do ========================================================================== */ $(window).on('load', function() { handlepreloader(); }); })(window.jquery);