仿YouTube页面加载 顶部进度条
页面加载时显示顶端进度条效果如下:
Pace.js,官网
使用方法
Pace.js会自动加载到页面中,不需要挂接到任何代码,会自动检测进度
在需要显示进度条的页面加入代码如下:
<head>
<link rel="stylesheet" href="../themes/red/pace-theme-flash.css" />
<script src="../pace.js"></script>
</head>
也可以根据需求进行自定义配置
paceOptions = {
// Disable the 'elements' source
elements: false,
// Only show the progress on regular and ajax-y page navigation,
// not every request
restartOnRequestAfter: false
}