因此,我一直在尝试获取“粒子”和“粒子”。上班。在检查控制台时,它表示" ParticleJS未定义",但我将id定义为'粒子'。非常感谢帮助,将来参考。
<div class="wrapper">
<div class="canvas">
<div id="particles">
<h1>We Love <span class="rotate">Simple, Responsive, Minimal, Fun</span></h1>
</div>
</div>
</div>
<script src="js/particles.js"></script>
.wrapper h1 {
font-size: 55px;
font-weight: 100;
margin-top:15%;
}
.canvas{ width:100%; height:95%; background:url(../img/banner.jpg) center; background-size:cover; position:relative; overflow:hidden;}
#particles {z-index: 4;height: 100%;height: 100vh;}
particlesJS('particles', {
particles: {
color: '#fff',
color_random: false,
shape: 'triangle', // "circle", "edge" or "triangle"
opacity: {
opacity: 1,
anim: {
enable: true,
speed: 1.5,
opacity_min: 0,
sync: false
}
答案 0 :(得分:0)
您必须首先初始化particle.js
脚本,然后才初始化其他脚本