科探空谷
  • Home
  • zhimind home
  • Categories
  • Tags
  • Archives
  • 留学
    • 学校库
    • 专业库
    • 研究方向与招生
    • 工具
    • GPA计算器
    • 脑洞背单词
    • 脱口而出

web简单进度条\加载中实现

js¶

call¶

$("#loadingDiv").remove();
var loadingDiv = createLoadingDiv('想写什么写什么')                    
//呈现loading效果
$("#learning>.container-fluid").append(loadingDiv);

implement¶

function createLoadingDiv(prompt) {
    var _PageWidth = document.documentElement.clientWidth,
            _PageHeight = document.documentElement.clientHeight,
            _LoadingTop = _PageHeight / 2,
            _LoadingLeft = _PageWidth > 215 ? (_PageWidth - 215) / 2 : 0,
            _LoadingHtml = $('<div></div>');
        _LoadingHtml.attr("id", "loadingDiv");
        _LoadingHtml.html("<p>"+prompt+"</p>");
        return _LoadingHtml
}

html¶

<script src="//www.zhimind.com/static/js/global.js" type="text/javascript"></script>
<link href="//www.zhimind.com/static/css/loader.css" rel="stylesheet" media="screen" type="text/css"/>

css¶

#loadingDiv {
    position: fixed;
    cursor1: wait;
    left: 0px;
    top: 0px;
    width: 100%;
    height: 100%; 
    left: 0px;
    top: 0px;
    background-color: transparent;
    background: url(/static/img/loading.gif) 50% 50% no-repeat; 
    z-index: 2;
}

#loadingDiv p {
    position: fixed;
    left: 52%;
    top: 49%;
}

Published

5月 30, 2017

Category

前端

Tags

  • css 2
  • html 2
  • js 2
  • web 11

Stay in Touch

  • Powered by Pelican. Theme: Elegant by Talha Mansoor