在pace.js中增加进度条加载时间

1 javascript plugins pace.js

我正在使用pace.js插件,它工作正常,但我希望进度条显示更长的时间,意味着增加加载时间,因此用户将长时间看到加载屏幕,默认情况下运行速度很快.我还将查看这些选项,但无法理解在何处添加代码以增加加载时间.

我试试这段代码,

window.paceOptions={
    initialRate:0.7,
    minTime:1750,
    maxProgressPerFrame:1,
    ghostTime: 120000
} 
Run Code Online (Sandbox Code Playgroud)

但它不起作用.

Vas*_*huk 5

您可以使用pace.js描述脚本标记的选项或data-pace-options属性

或者更好 - 在简单标记脚本(普通js)中包含pace.js(在库启动之前设置值),如下所示:

<!DOCTYPE html>
<html>
<head>
  <script>
    paceOptions = {
    initialRate:0.7,
    minTime:1750,
    maxProgressPerFrame:1,
    ghostTime: 120000
}
  </script>
<script src="https://rawgit.com/HubSpot/pace/master/pace.js"></script>
   <link href="https://rawgit.com/HubSpot/pace/master/themes/green/pace-theme-barber-shop.css" rel="stylesheet" />
  <meta charset="utf-8">
  <title>Pace</title>
</head>
<body>

</body>
</html>
Run Code Online (Sandbox Code Playgroud)

试试这里:http://jsbin.com/pumarikixa/1/

要更改速度,请参阅eventLag选项 -

  eventLag : {
    minSamples: 10,
    sampleCount: 300,
    lagThreshold: 1
  }
Run Code Online (Sandbox Code Playgroud)

http://jsbin.com/pequdepaga/1/之类的东西