我想在进度条上方有一个百分比框,告诉进度条的百分比
我是 jquery 的新手,我尝试了一些东西,但我不知所措,我希望有人能告诉我方法。
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Untitled 1</title>
<link type="text/css" rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquerui.js"></script>
<script type="text/javascript">
$(document).ready(function () {
var target = new Date('10/25/2013'),
today = new Date(),
daysToGo = Math.ceil((target.getTime() - today.getTime() ) / (1000*60*60*24)),
// probably not the best, but it should work
percent = 100 - daysToGo;
$('#percent').text (percent + '%');
$("#progressbar").progressbar({
value: percent,
create: function(event, ui) {
$('.ui-progressbar').append(daysToGo + ' days left!');
}
});
});
</script>
</head>
<body>
<div id="progressbar"></div>
<div id="percent"></div>
</body>
</html>