main.js 899 字节
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
function pageload() {
    window.addEventListener('scroll', function(e){
        var distanceY = window.pageYOffset || document.documentElement.scrollTop
        var shrinkOn = 94
        home = document.getElementById("home");
        links = document.getElementById("jumplinks");
        search = document.getElementById("search");
        body = document.getElementById("body");
        if (distanceY > shrinkOn) {
            if (home.className != "navhide") {
                body.className = "navhide"
                home.className = "navhide"
                links.className = "navhide"
                search.className = "navhide"
            }
        } else {
            if (home.className == "navhide") {
                body.className = ""
                home.className = ""
                links.className = ""
                search.className = ""
            }
        }
    });
}