javascript - Issues using particles.js and fullpage.js? -
i trying build single page site using fullpage.js library works great! add particle effect particle.js library first section of site.
no matter try, seems particles not show , i'm not sure issue be, appreciated! code follows:
html:
<div class="section" id="particles-js"></div>
js:
particlesjs.load('particles-js', '/assets/particles.json', function() { console.log('callback - particles.js config loaded'); });
css:
#particles-js { background: cornflowerblue; }
my particles.json file default 1 provided library here.
my js code in file called init_libraries.js added html page this:
<script src="/javascript/bootstrap.min.js"></script> <script src="/javascript/jquery.fullpage.min.js"></script> <script src="/javascript/particles.min.js"></script> <script src="/javascript/init_libraries.js"></script>
when start site, see "callback - particles.js config loaded" message library , config file seem loaded fine still see no particle on site. ideas?
edit:
ended figuring 1 out after while, had change html this:
<div id="particles-js"> <canvas class="particles-js-canvas-el" style="width: 100%; height: 100%;"></canvas> </div>
also had add following css particles behind text , button:
canvas { position: absolute; top: 0; z-index: 1; } .container { position: relative; z-index: 9999; } .container h1 { position: relative; z-index: 9999; }
works great now! library js files in correct location.
i guess assets not in javascript folder. check if relative path 'particles.json' correct.
particlesjs.load('particles-js', '../assets/particles.json', function() { console.log('callback - particles.js config loaded'); });
sorry can not comment :/
Comments
Post a Comment