So I have a page in HTML which has a background based on the well-known particle library. I have a button and there is a problem with it: it can be seen but it cannot be clicked. I tried changing the size and the alignment of the background but cannot make it to work... How to make the button clickable?
My code:
HTML:
<div id="particles-js" ><canvas class="particles-js-canvas" width="500" height="1000"></canvas></div> <button type="button" class="btn btn-info" onclick="alert('hello')">Info</button> CSS:
body { background: #212121; } .particles-js-canvas{ width: 100%; height: 100%; position: fixed; left: 0px; right: 0px; } And the Javascript code to initialize the particles:
$(window).on('load', function() { particlesJS("particles-js", { "particles": { "number": { "value": 400, "density": { "enable": true, "value_area": 400 } }, "color": { "value": "#ffffff" }, "shape": { "type": "circle", "stroke": { "width": 0, "color": "#000000" }, "polygon": { "nb_sides": 4 }, "image": { "src": "http://wiki.lexisnexis.com/academic/images/f/fb/Itunes_podcast_icon_300.jpg", "width": 100, "height": 100 } }, "opacity": { "value": 0.5, "random": true, "anim": { "enable": false, "speed": 1, "opacity_min": 0.1, "sync": false } }, "size": { "value": 2, "random": true, "anim": { "enable": false, "speed": 40, "size_min": 0.1, "sync": false } }, "line_linked": { "enable": false, "distance": 150, "color": "#ffffff", "opacity": 0.4, "width": 1 }, "move": { "enable": true, "speed": 1, "direction": "bottom", "random": false, "straight": true, "out_mode": "out", "bounce": false, "attract": { "enable": false, "rotateX": 600, "rotateY": 1200 } } }, "interactivity": { "detect_on": "canvas", "events": { "onhover": { "enable": false, "mode": "grab" }, "onclick": { "enable": false, "mode": "repulse" }, "resize": true }, "modes": { "grab": { "distance": 200, "line_linked": { "opacity": 1 } }, "bubble": { "distance": 400, "size": 40, "duration": 2, "opacity": 8, "speed": 3 }, "repulse": { "distance": 200, "duration": 0.4 }, "push": { "particles_nb": 4 }, "remove": { "particles_nb": 2 } } }, "retina_detect": true }); });