为什么进度条不加载?
Why the progress bar does not load?
以下代码在 jsfiddle 和此处的代码片段中运行良好,但在我拥有的 html 文件中,js 代码无法运行并且 var bar = new ProgressBar.Line(container,
无法运行。
这是我的文件 link: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>
将进度条 UI 放在对 progressbar.min.js 的引用之后。最好在文档的末尾。
在你的无标题文档中是之前。
以下代码在 jsfiddle 和此处的代码片段中运行良好,但在我拥有的 html 文件中,js 代码无法运行并且 var bar = new ProgressBar.Line(container,
无法运行。
这是我的文件 link: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>
将进度条 UI 放在对 progressbar.min.js 的引用之后。最好在文档的末尾。 在你的无标题文档中是之前。