2016-08-15 59 views
0

下面的代碼在jsfiddle和這裏的代碼片段中運行的很好,但是在我有js代碼的html文件中不起作用,var bar = new ProgressBar.Line(container,無法運行。爲什麼進度條無法加載?

這裏是鏈接到我的文件:https://github.com/yzdnisr/js_problem

任何建議,以解決這個問題是值得歡迎的。

var bar = new ProgressBar.Line(container, { 
 
    strokeWidth: 4, 
 
    easing: 'easeInOut', 
 
    duration: 1400, 
 
    color: '#FFEA82', 
 
    trailColor: '#eee', 
 
    trailWidth: 1, 
 
    svgStyle: { 
 
    width: '100%', 
 
    height: '100%', 
 
    position: 'absolute' 
 
    } 
 
}); 
 

 
bar.animate(1.0); // Number from 0.0 to 1.0
#liner { 
 
    position: relative; 
 
    width: 600px; 
 
    height: 7px; 
 
    background-color: #000000; 
 
} 
 
#container { 
 
    position: absolute; 
 
    width: 400px; 
 
    height: 7px; 
 
    background-color: #f0f0f0; 
 
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/progressbar.js/1.0.1/progressbar.min.js"></script> 
 
<div id="liner"> 
 
    <div id="container"></div> 
 
</div>

+0

那麼如果它在這裏工作,那麼你的代碼有問題。放在這裏。 – Phiter

+0

請提供您的代碼或至少一個鏈接到您的實施... – andreas

+1

[檢查您的控制檯的錯誤](http://stackoverflow.com/documentation/javascript/185/hello-world/714/using-console-log )。 –

回答

1

將您的進度條UI的參考progressbar.min.js了。最好在文件的末尾。 在你的無標題文檔中,它是以前的。