function ready(fn) {
    if (document.readyState != "loading") {
        fn();
    } else {
        document.addEventListener("DOMContentLoaded", fn);
    }
}

function addClickHandlers() {
    var links = document.querySelectorAll(".scroll-anchor a");
    for (var i = 0; i < links.length; i++) {
        links[i].addEventListener("click", function (evt) {
            // If preventDefault isn't called, the browser will scroll to the
            // element before our animation starts. Then, when our animation
            // starts and scrolls the page a bit, the page will "jump" back to
            // just after where it started. This is because the browser already
            // scrolled the page, so what should be a small step turns into a
            // leap. Calling preventDefault stops the browser from scrolling
            // before our animation, and thus prevents a flash from occuring.
            evt.preventDefault();
            scrollToElement(document.querySelector(evt.target.hash), 800);
        });
    };
};

ready(addClickHandlers);
var scrollToElement = (function () {
    var animation,
        animating = false;

    var scrollToElement = function (elem, duration) {
        if (animating || !requestAnimationFrame) {
            return;
        }

        var elemTop = elem.getBoundingClientRect().top,
            scrollY = window.pageYOffset,
            bodyStyle = getComputedStyle(document.body),
            bodyMargin = parseInt(bodyStyle.marginTop) +
                         parseInt(bodyStyle.marginBottom),
            bodyHeight = document.body.offsetHeight + bodyMargin,
            maxScrollY = bodyHeight - window.innerHeight;

        animation = {
            startY: scrollY,
            distanceY: Math.min(elemTop + scrollY, maxScrollY) - scrollY,
            startTime: Date.now(),
            duration: duration,
            prevScrollY: -1,
            hash: "#" + elem.id
        };
        animating = true;
        requestAnimationFrame(step);
    };

    var step = function (timestamp) {
        if (!animating) return;

        var now = timestamp < 1e12 ? Date.now() : timestamp,
            elapsedTime = now - animation.startTime,
            easeCoefficient = swingEase(elapsedTime / animation.duration),
            scrollY = Math.round(animation.startY +
                                 animation.distanceY * easeCoefficient);

        if (elapsedTime >= animation.duration) {
            animating = false;
            // Since we called preventDefault earlier, we must manually update
            // the hash to emulate the native behavior of clicking on a link.
            // It's updated when the animation is over because setting the hash
            // before would scroll the page before the animation plays--the
            // very reason for calling preventDefault.
            location.hash = animation.hash;
        } else {
            if (scrollY != animation.prevScrollY) {
                window.scrollTo(0, scrollY);
            }
            requestAnimationFrame(step);
            animation.prevScrollY = scrollY;
        }
    };

    // jQuery v3.1.1 | (c) jQuery Foundation | jquery.org/license
    // "swing" ease function is from jQuery
    var swingEase = function (t) {
        return 0.5 - Math.cos(t * Math.PI) / 2;
    };

    return scrollToElement;
}());

@@ -347,24 +347,400 @@
 ion (evt) %7B%0A
+            scrollToElement(document.querySelector(evt.target.hash), 800);%0A        %7D);%0A    %7D;%0A%7D;%0A%0Aready(addClickHandlers);%0Avar scrollToElement = (function () %7B%0A    var animation,%0A        animating = false;%0A%0A    var scrollToElement = function (elem, duration, evt) %7B%0A        if (animating %7C%7C !requestAnimationFrame) %7B%0A            return;%0A        %7D else if (evt != undefined) %7B%0A
             
@@ -1286,20 +1286,27 @@
         
-evt.
+// We call 
 preventD
@@ -1315,23 +1315,11 @@
 ault
-();%0A           
+ in
  scr
@@ -1334,159 +1334,28 @@
 ment
-(document.querySelector(evt.target.hash), 800);%0A        %7D);%0A    %7D;%0A%7D;%0A%0Aready(addClickHandlers);%0Avar scrollToElement = (function () %7B%0A    var animati
+ so that clicking 
 on
-,
 %0A   
@@ -1363,151 +1363,111 @@
     
-animating = false;%0A%0A    var scrollToElement = function (elem, duration) %7B%0A        if (animating %7C%7C !requestAnimationFrame) %7B%0A            return
+    // a link still works when requestAnimationFrame is not supported.%0A            evt.preventDefault()
 ;%0A  

Update static