zoukankan      html  css  js  c++  java
  • js 层随着滚动条上下移动

    var tips;
    var theTop = 10; /*这是默认高度,越大越往下*/
    var old = theTop;

    function moveTips() {
        var tt = 0;
        if (window.innerHeight) {
            pos = window.pageYOffset
        } else if (document.documentElement && document.documentElement.scrollTop) {
            pos = document.documentElement.scrollTop
        } else if (document.body) {
            pos = document.body.scrollTop;
        }

        pos = pos - tips.offsetTop + theTop;
        pos=tips.offsetTop+pos/10;
        if (pos < theTop) pos = theTop;
        if (pos != old) {
            tips.style.top = pos+"px";
            tt = 0;
        }
        old = pos;
        setTimeout(moveTips,tt);
    }

    onload = function initFloatTips() {
        tips = document.getElementById('clockDiv');
        moveTips();
    };
  • 相关阅读:
    Spring 增强类型
    Spring IOC及Bean的生命周期
    Spring
    Mybatis注解
    MyBatis关联查询
    LoadRunner(1)
    Selenium(6)
    Selenium(5)
    Selenium(4)
    Selenium(3)
  • 原文地址:https://www.cnblogs.com/xinlang/p/1326206.html
Copyright © 2011-2022 走看看