首先我看到内容,然后我看到 keywords-js。我想确保我能同时看到 keywords-js 和 。 我使用物化CSS 代码:
<div class="page-wrapper"> <div class="content">.... </div> </div>
<div id="particles-js"> </div>
<!-- Particles JS -->
<script > .... </script>
最佳答案
您的样式似乎已损坏或丢失
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>
关于javascript - 为什么 Particles-js 不能正常工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49812069/