引用了线上的jquery文件, 复制新建html文件可实现demo.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.0/jquery.min.js"></script>
<title>进度条</title>
</head>
<style type="text/css">
body {
margin: 0;
padding: 0;
}
p {
margin: 0;
}
@-moz-keyframes progressing {
0% {
width: 0px;
}
100% {
width: 100%;
}
}
@-webkit-keyframes progressing {
0% {
width: 0px;
}
100% {
width: 100%;
}
}
.progress {
width: 100%;
height: 2px;
overflow: hidden;
background-color: #27ccc0;
position: fixed;
top: 0;
left: 0;
z-index: 9;
-moz-animation: progressing 2s ease-out;
-webkit-animation: progressing 2s ease-out;
}
</style>
<body>
<p class="progress"></p>
</body>
<script type="text/javascript">
$('.progress').one('animationend',function(){
console.log('动画结束');
$('.progress').hide();
})
</script>
</html>