var common = function () {
    // setTimeout(() => window.scrollTo(0,0), 14)
    // 侧边二维码动画
    var qr_code = document.getElementsByClassName("qr_code")[0];
    var code_img = this.document.getElementsByClassName("code_img")[0];
    qr_code.onmouseover = function () {
        code_img.style.opacity = 1;
        code_img.style.animation = "rightLeft .8s  ease-in-out forwards"
    }
    qr_code.onmouseout = function () {
        code_img.style.opacity = 0;
        code_img.style.animation = ""
    }

    // 返回顶部
    var go_top = document.getElementsByClassName("go_top")[0];
    var timer = null;
    go_top.onclick = function () {
        cancelAnimationFrame(timer);
        timer = requestAnimationFrame(function fn() {
            var oTop = document.body.scrollTop || document.documentElement.scrollTop;
            if (oTop > 0) {
                document.body.scrollTop = document.documentElement.scrollTop = oTop - 300;
                timer = requestAnimationFrame(fn);
            } else {
                cancelAnimationFrame(timer);
            }
        });
    }

    // 点击预约面试按钮显示二维码
    if (document.getElementById("order")) {
        var order = document.getElementById("order");
        var img = document.getElementById("code_img");
        order.onclick = function () {
            img.style.animation = "fadeInBig .8s ease-in-out forwards"
        }
    }
}