zoukankan      html  css  js  c++  java
  • 网页进度条的实现

    1.当页面在向服务器获取数据需要较长时间时,可以将页面暂时屏蔽,并显示进度条,虽然进度条并不能真实的反映页面加载的情况,但是却是一种很好的用户体验。

    function show() {
        var bgDiv = document.createElement("div");
        bgDiv.id = "bgDiv";
        bgDiv.style.position = "absolute";
        bgDiv.style.left = 0;
        bgDiv.style.top = 0;
        bgDiv.style.backgroundColor = "Gray";
        bgDiv.style.width = 0;
        bgDiv.style.height = 0;
        bgDiv.style.zIndex = 10000;
        bgDiv.style.visibility = "hidden";
        bgDiv.style.opacity = 0.4;
        bgDiv.style.filter = "alpha(opacity=40)";
        document.body.appendChild(bgDiv);
        var barDiv = document.createElement("div");
        barDiv.id = "barDiv";
        barDiv.align = "center";
        barDiv.style.position = "absolute";
        barDiv.style.left = "50%";
        barDiv.style.top = "50%";
        barDiv.style.zIndex = 10001;
        barDiv.style.marginLeft = -107;
        barDiv.style.marginTop = -7;
        barDiv.style.visibility = "hidden";
        document.body.appendChild(barDiv);
        var tagSelectList = document.getElementsByTagName("select");
        for (i = 0; i < tagSelectList.length; i++)
        {
            tagSelectList[i].style.visibility = "hidden";
        }
        bgDiv.style.visibility = 'visible';
        bgDiv.style.width = (document.body.scrollWidth > window.screen.width ? document.body.scrollWidth : window.screen.width) + "px";
        bgDiv.style.height = (document.body.scrollHeight > window.screen.height ? document.body.scrollHeight : window.screen.height) + "px";
        barDiv.style.visibility = 'visible';
    }
  • 相关阅读:
    小毛驴基本语法
    文本数据IO操作--字符流
    基本IO操作--字节流
    文件指针操作
    文件操作——RandomAccessFile
    Java文件操作——File
    前端修炼-javascript关键字之prototype
    Redux介绍及基本应用
    IOS应用程序生命周期
    EF 只更新部分字段
  • 原文地址:https://www.cnblogs.com/sydeveloper/p/2587208.html
Copyright © 2011-2022 走看看