[英]Why the progress bar does not load?
The following code runs pretty well in jsfiddle and here in the snippet, but in the html file that I have the js code does not function and var bar = new ProgressBar.Line(container,
does not operate. 以下代码在jsfiddle和代码段中运行良好,但是在我拥有js代码的html文件中,该代码无法正常运行,并且
var bar = new ProgressBar.Line(container,
无法运行。
Here is the link to my files: https://github.com/yzdnisr/js_problem 这是我文件的链接: https : //github.com/yzdnisr/js_problem
Any suggestions to solve this problem is welcome. 欢迎提供解决此问题的任何建议。
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>
Place your progress bar UI AFTER the reference to the progressbar.min.js. 将进度条UI放在对progressbar.min.js的引用之后。 Preferably at the end of the document.
最好在文档末尾。 In your untitled document it is before.
在您的无标题文档中,它早于。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.