/* ---------- js ---------- */ jQuery(function ($) { $(window).scroll(function () { var w_top = $(window).scrollTop(); if (w_top > 146) { $("#headerInner").addClass("fixed"); } else { $("#headerInner").removeClass("fixed"); } }); /* =============== Animations =============== */ var contentWayPoint = function () { var i = 0; $('.animate-box').waypoint(function (direction) { if (direction === 'down' && !$(this.element).hasClass('animated')) { i++; $(this.element).addClass('item-animate'); setTimeout(function () { $('body .animate-box.item-animate').each(function (k) { var el = $(this); setTimeout(function () { var effect = el.data('animate-effect'); if (effect === 'fadeIn') { el.addClass('fadeIn animated'); } else if (effect === 'fadeInLeft') { el.addClass('fadeInLeft animated'); } else if (effect === 'fadeInRight') { el.addClass('fadeInRight animated'); } else { el.addClass('fadeInUp animated'); } el.removeClass('item-animate'); }, k * 200, 'easeInOutExpo'); }); }, 100); } }, { offset: '85%' }); }; var counter = function () { $('.js-counter').countTo({ formatter: function (value, options) { return value.toFixed(options.decimals); }, }); }; var counterWayPoint = function () { if ($('#counter-animate').length > 0) { $('#counter-animate').waypoint(function (direction) { if (direction === 'down' && !$(this.element).hasClass('animated')) { setTimeout(counter, 400); $(this.element).addClass('animated'); } }, { offset: '90%' }); } }; $(window).scroll(function () { if ($(this).scrollTop() > 50) { $('.back-to-top').fadeIn('slow'); } else { $('.back-to-top').fadeOut('slow'); } }); $('.back-to-top').click(function () { $("html, body").animate({ scrollTop: 0 }, 500); return false; }); $('.go-to-top').click(function () { $("html, body").animate({ scrollTop: 0 }, 500); return false; }); // Document on load. $(function () { contentWayPoint(); }); });