簡體   English   中英

增加apache.js中progressbar的加載時間

[英]increase progressbar loading time in pace.js

我正在使用pace.js插件,它可以正常工作,但是我希望進度條顯示更長的時間,這意味着增加了加載時間,因此用戶會看到加載屏幕很長一段時間,默認情況下運行速度很快。 我還將查看這些選項,但不知道在哪里添加代碼以增加加載時間。

我嘗試這段代碼,

window.paceOptions={
    initialRate:0.7,
    minTime:1750,
    maxProgressPerFrame:1,
    ghostTime: 120000
} 

但它不起作用。

您可以使用speed.js在腳本標簽中描述選項或在data-pace-options屬性中

或更好-在簡單的標記腳本(純js)中,先包含spacing.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>

在這里嘗試: http : //jsbin.com/pumarikixa/1/

要更改速度,請參閱eventLag選項-

  eventLag : {
    minSamples: 10,
    sampleCount: 300,
    lagThreshold: 1
  }

http://jsbin.com/pequdepaga/1/之類的東西

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM