我尝试不加修改地运行Particles.Js,但它开箱即用就失败了,错误如下:
Uncaught TypeError: pJS_tag is null我已经通过npm install安装了它。这是我的HTML
particlesJS.load('particles-js', 'assets/particles.json', function() {
console.log('callback - particles.js config loaded');
});<!doctype html>
<html>
<head>
<link rel="stylesheet" href="./style.css">
<script src="/node_modules/particles.js/particles.js"> </script>
</head>
<body>
<div class="particles-js"></div>
<div class="banner">test</div>
<script src=
"/node_modules/particles.js/demo/js/app.js">
</script>
</body>
</html>
发布于 2021-02-14 14:11:43
我发现了我的错误,我忘记设置"id“字段,并认为"class”就足够好了。
示例:更改
<div class="particles-js"></div>至:
<div class="particles-js" id="particles-js"></div>https://stackoverflow.com/questions/66180631
复制相似问题