<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>移動(dòng)端進(jìn)度條</title>
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<style>
html {
font-size: 20px;
}
body {
font-size: 16px;
font-family: "微軟雅黑";
}
@media only screen and (max-width: 320px) { html {
font-size: 42.7px !important;
}}
@media only screen and (min-width: 321px) and (max-width: 360px) { html {
font-size: 48px !important;
}}
@media only screen and (min-width: 361px) and (max-width: 375px) { html {
font-size: 50px !important;
}}
@media only screen and (min-width: 376px) and (max-width: 384px) { html {
font-size: 52.1px !important;
}}
@media only screen and (min-width: 385px) and (max-width: 414px) { html {
font-size: 55.2px !important;
}}
@media only screen and (min-width: 415px) and (max-width: 480px) { html {
font-size: 64px !important;
}}
@media only screen and (min-width: 481px) and (max-width: 540px) { html {
font-size: 72px !important;
}}
@media only screen and (min-width: 750px) { html {
font-size: 100px !important;
}}
.loading_fater{
width: 4.14rem;
height: 0.44rem;
line-height: 0.44rem;
background: #391956;
border: 3px solid #FFFFFF;
box-shadow: 0 3px 7px 0 rgba(189,16,224,0.50);
border-radius: 100px;
position: relative;
margin: 50% auto 0;
}
.loading{
width: 0.02rem;
height: 0.44rem;
background: #FE6365;
box-shadow: inset 0 0 4px 0 #470707;
border-radius: 100px;
}
.loading_fater> span{
color: white;
position: absolute;
top: 0;
left: 2rem;
}
</style>
</head>
<body>
<div class="loading_fater">
<div class="loading"></div>
<span><label class="bfb">0</label>%</span>
</div>
<script type="text/javascript">
/**
* 由于js并不能獲取下載所需資源包文件大小
* 所以只能在頁面各個(gè)部位插入代碼片段, 更新進(jìn)度條, 以模擬資源下載(讀取)進(jìn)度
*/
updateLoading(10,1);
//用延遲 模擬加載文件需要的時(shí)間
setTimeout(function(){
updateLoading(60,1);
},1000)
setTimeout(function(){
updateLoading(100,1);
},3000)
var bfb = document.getElementsByClassName('bfb')[0];
/**
* 更新進(jìn)度條
* @param {Object} bfb_num :更新進(jìn)度條數(shù)字baifenbi (10)
* @param {Object} millisecond :動(dòng)畫執(zhí)行毫秒數(shù)
*/
function updateLoading(bfb_num,millisecond){
document.getElementsByClassName('loading')[0].style.cssText = 'width: '+bfb_num+'%;transition-duration:'+millisecond+'s;'
var load_Interval = setInterval(function(){
if(bfb.innerHTML < bfb_num){
bfb.innerHTML = parseInt(bfb.innerHTML)+1;
}else{
clearInterval(load_Interval);
}
},millisecond*1000/bfb_num)
}
</script>
</body>
</html>
H5移動(dòng)端 進(jìn)度條加載
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。
相關(guān)閱讀更多精彩內(nèi)容
- 前言 H5加載慢,想要在移動(dòng)端顯示加載進(jìn)度?答案就是這么簡單!歡迎加入學(xué)習(xí)小組QQ群: 193765960。 版權(quán)...
- 前言在之前的文章中,我曾經(jīng)給出了一種控制進(jìn)度條顯示和消失時(shí)機(jī)的方式。經(jīng)過實(shí)際的測試發(fā)現(xiàn),很多情況下然并卵。于是乎又...
- 近期的項(xiàng)目是使用react+antd-mobile的h5移動(dòng)網(wǎng)頁端的一個(gè)程序,其中一個(gè)功能是一個(gè)展示列表,具有下拉...
- 轉(zhuǎn)載:H5緩存機(jī)制淺析-移動(dòng)端Web加載性能優(yōu)化【干貨】 作者:賀輝超,騰訊游戲平臺與社區(qū)產(chǎn)品部 高級工程師 目錄...
- 使用到的第三方庫:NJKWebViewProgress 使用:采用代理方式,在代理中獲取進(jìn)度,并賦值給進(jìn)度條。具體...