/* Sticky Navigation */ $(function() { var sticky = $('.sticky'); var contentOffset; var nav_height; if (sticky.length) { if ( sticky.data('offset') ) { contentOffset = sticky.data('offset'); } else { contentOffset = sticky.offset().top; } nav_height = sticky.height(); } var scrollTop = $(window).scrollTop(); var window_height = $(window).height(); var doc_height = $(document).height(); $(window).bind('resize', function() { scrollTop = $(window).scrollTop(); window_height = $(window).height(); doc_height = $(document).height(); navHeight(); }); $(window).bind('scroll', function() { stickyNav(); }); function navHeight() { sticky.css('max-height', window_height + 'px'); } function stickyNav() { scrollTop = $(window).scrollTop(); if (scrollTop > contentOffset) { sticky.addClass('fixed'); } else { sticky.removeClass('fixed'); } } }); $('document').ready(function() { var nav_height = 70; $("a[data-role='smoothscroll']").click(function(e) { e.preventDefault(); var position = $($(this).attr("href")).offset().top - nav_height; $("body, html").animate({ scrollTop: position }, 1000 ); return false; }); }); $('document').ready(function() { // Back to top var backTop = $(".back-to-top"); $(window).scroll(function() { if($(document).scrollTop() > 400) { backTop.css('visibility', 'visible'); } else if($(document).scrollTop() < 400) { backTop.css('visibility', 'hidden'); } }); backTop.click(function() { $('html').animate({ scrollTop: 0 }, 1000); return false; }); }); $('document').ready(function() { // Loader $(window).on('load', function() { $('.loader-container').fadeOut(); }); // Tooltips $('[data-toggle="tooltip"]').tooltip(); // Popovers $('[data-toggle="popover"]').popover(); // Page scroll animate new WOW().init(); });