zoukankan      html  css  js  c++  java
  • 进度条简单实现

    这种方式实现进度条只需要导入jquery文件就可以用了,非常简单

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <script src="jquery-1.9.1.js"></script>
    
    <style>
    .progressBar{
        width:200px; height:12px; border:1px solid #98AFB7; border-radius:5px; margin-top:10px;
    }
    #bar{
        width:0px; height:10px; border-radius:4px; background:#5EC4EA;
    }
    </style>
    
    <script type="text/javascript">
    function progressBar(){
        //初始化js进度条
        $("#bar").css("width","0px");
        //进度条的速度,越小越快
        var speed = 50;
    
        bar = setInterval(function(){
            
            nowWidth = parseInt($("#bar").width());
            //宽度要不能大于进度条的总宽度
            if(nowWidth<=198){
                barWidth = (nowWidth + 1)+"px";
                $("#bar").css("width",barWidth);
            }else{
                //进度条读满后,停止
                clearInterval(bar);
            } 
        },speed);
    }
    </script>
    </head>
    <body style="font-family: 微软雅黑; padding:20px;">
    
    <div id="progress" style="100%; height:100%; position:absolute; top:0; left:0; z-index:999; display:block;">
    <input type="button" value="开始" onclick="progressBar()" />
    <div class="progressBar">
        <div id="bar"></div>
    </div>
    <div>
    </body>
    </html>
  • 相关阅读:
    常用的字符集编码
    live555—VS2010/VS2013 下live555编译、使用及测试(转载)
    win32下Socket编程(转载)
    do{...}while(0)的意义和用法(转载)
    C++ static与单例模式
    MFC多线程各种线程用法 .
    a^1+b problem
    重返现世——题解
    第K大C
    懒癌
  • 原文地址:https://www.cnblogs.com/jadening/p/5710307.html
Copyright © 2011-2022 走看看