//Make Navbar fixed to top of screen after scrolling past header document.addEventListener("DOMContentLoaded", function () { window.addEventListener('scroll', function () { if (window.scrollY > 253) { document.getElementById('site-navigation').classList.add('nav-fixed'); // add padding top to show content behind navbar navbar_height = document.querySelector('.navbar').offsetHeight; document.body.style.paddingTop = navbar_height + 'px'; } else { document.getElementById('site-navigation').classList.remove('nav-fixed'); // remove padding top from body document.body.style.paddingTop = '0'; } }); }); // DOMContentLoaded end //Smooth Scrolling $(document).ready(function () { // Add smooth scrolling to all links $("a").on('click', function (event) { // Make sure this.hash has a value before overriding default behavior if (this.hash !== "") { // Prevent default anchor click behavior - commented out to allow jumping to anchors on other pages. //event.preventDefault(); // Store hash var hash = this.hash; //Store extra offset value var offsetY = 60 // Using jQuery's animate() method to add smooth page scroll // The optional number (800) specifies the number of milliseconds it takes to scroll to the specified area $('html, body').animate({ scrollTop: $(hash).offset().top - offsetY // }, 800, function () { // Add hash (#) to URL when done scrolling (default click behavior) window.location.hash = hash; }); } // End if }); }); //AutoPlay Youtube Video Banner on Mobile Devices