(function ($) { 'use strict'; function initStickyAdd() { $(window).on('scroll',function() { var scroll = $(window).scrollTop(); if (scroll >= 50) { $(".sticky").addClass("stickyadd"); } else { $(".sticky").removeClass("stickyadd"); } }); } function initSmoothNav() { $('.navbar-nav a').on('click', function(event) { var $anchor = $(this); $('html, body').stop().animate({ scrollTop: $($anchor.attr('href')).offset().top - 0 }, 1500, 'easeInOutExpo'); event.preventDefault(); }); } function initScrollspy() { $("#navbarCollapse").scrollspy({ offset:20 }); } function initPortfolio() { $(window).on('load', function() { var $container = $('.work-filter'); var $filter = $('#menu-filter'); $container.isotope({ filter: '*', layoutMode: 'masonry', animationOptions: { duration: 750, easing: 'linear' } }); $filter.find('a').on("click", function() { var selector = $(this).attr('data-filter'); $filter.find('a').removeClass('active'); $(this).addClass('active'); $container.isotope({ filter: selector, animationOptions: { animationDuration: 750, easing: 'linear', queue: false, } }); return false; }); }); } $(window).on('scroll',function(){ if ($(this).scrollTop() > 100) { $('.back_top').fadeIn(); } else { $('.back_top').fadeOut(); } }); $('.back_top').on('click',function(){ $("html, body").animate({ scrollTop: 0 }, 1000); return false; }); $('.img-zoom').magnificPopup({ type: 'image', closeOnContentClick: true, mainClass: 'mfp-fade', gallery: { enabled: true, navigateByImgClick: true, preload: [0, 1] } }); function init() { initStickyAdd(); initSmoothNav(); initScrollspy(); initPortfolio(); } init(); })(jQuery); //Client Slider $("#owl-demo").owlCarousel({ autoPlay: 1e4, items: 3, itemsDesktop: [1199, 3], itemsDesktopSmall: [979, 3] }); $(".video_hit , .video_home , .video_blog").magnificPopup({ disableOn:700, type:"iframe", mainClass:"mfp-fade", removalDelay:160, preloader:!1, fixedContentPos:!1 }); //Funfacts var a = 0; $(window).on('scroll',function() { var oTop = $('#counter').offset().top - window.innerHeight; if (a == 0 && $(window).scrollTop() > oTop) { $('.lan_fun_value').each(function() { var $this = $(this), countTo = $this.attr('data-count'); $({ countNum: $this.text() }).animate({ countNum: countTo }, { duration: 2000, easing: 'swing', step: function() { $this.text(Math.floor(this.countNum)); }, complete: function() { $this.text(this.countNum); //alert('finished'); } }); }); a = 1; } }); $(".simple-text-rotate").textrotator({ animation: "fade", speed: 3500 }); $(document).mousemove(function(t) { $(".about-tween").parallax(70, t) }); $(".text-typed").each(function() { var t = $(this); t.typed({ strings: t.attr("data-elements").split(","), typeSpeed: 100, backDelay: 3e3 }) }); var loader = $(".loader"), wHeight = $(window).height(), wWidth = $(window).width(), o = 0; loader.css({ top: wHeight / 2 - 2.5, left: wWidth / 2 - 200 }); do { loader.animate({ width: o }, 10), o += 3 } while (o <= 400); 402 === o && (loader.animate({ left: 0, width: "100%" }), loader.animate({ top: "0", height: "100vh" })), setTimeout(function() { $(".loader-wrapper").fadeOut("fast"), loader.fadeOut("fast") }, 3500);