首先我看到了内容,然后我看到了粒子-js。我想确保我同时看到粒子-js。 我使用materialize CSS 代码:
<div class="page-wrapper"> <div class="content">.... </div> </div>
<div id="particles-js"> </div>
<!-- Particles JS -->
<script > .... </script>
答案 0 :(得分:1)
好像你的风格破了或缺失
particlesJS.load('particles-js', 'https://cdn.jsdelivr.net/npm/particles.js@2.0.0/demo/particles.json', function() {
//callback
});
html {
width: 100%;
height: 100%;
}
body {
background-color: black;
display: flex;
width: 100%;
height: 100%;
justify-content: center;
align-items: center;
}
#particles-js {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 0;
}
.my-content {
z-index: 1;
width: 150px;
height: 150px;
background-color: white;
}
<script src="https://cdn.jsdelivr.net/npm/particles.js@2.0.0/particles.min.js"></script>
<div class="my-content">
my content
</div>
<div id="particles-js"></div>