0

我的页面顶部有一个进度条,我希望该条显示网页加载的进度。当整个页面加载时,我希望栏显示 100%。我很确定我需要列出一个变量 '$(window).load();' 但我不确定在哪里。

我的代码:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>test</title>
<style>
progress {
width: 100%;
height: 5px;
top: 0;
left: 0;
position: absolute;
color: #1990c8;
appearance: none;
-webkit-appearance: none;
-o-appearance: none;
}
progress::-moz-progress-bar { 
background: #1990c8;
}
progress::-webkit-progress-value {
background: #1990c8;
}
progress::-webkit-progress-bar {
background: #e1e1e1;
}
</style>
</head>
<body>
<progress id="progressbar" value="0" max="100"></progress>
<span id="status"></span>
<script type="text/javascript" language="javascript">
function progressbaranimation(a) {
var bar = document.getElementById('progressbar');
bar.value = a;
a++;
var sim = setTimeout("progressbaranimation("+a+")");
}
var amount = 0;
progressbaranimation(amount);
</script>
<img src="http://media.npr.org/images/picture-show-flickr-promo.jpg">
<img src="http://dd508hmafkqws.cloudfront.net/sites/default/files/mediaimages/gallery/2012/Dec/AA-502716%20(1).jpg">
</body>
</html>
4

1 回答 1

0

您可以使用基本的 javascript 来做到这一点。检查这个http://yensdesign.com/2008/11/how-to-create-a-stylish-loading-bar-as-gmail-in-javascript/

于 2013-10-06T09:49:22.140 回答