-
AuthorPosts
-
January 28, 2020 at 9:57 am #1178925
Dear Kriesi team!
i tried to add a code in the code-block which is in the full width section #homedesktoptest but the background animation disapears only in a small section in the middle of the page.
The background shows up in the actual class: #particles-js > canvas
but i added the code to the class #homedesktoptest
Should i use the hole enfold class: #homedesktoptest > div > div.container > div ?<html> <head> <style> /* ---- reset ---- */ #top .homedesktoptest{ margin:0; font:normal 75% Arial, Helvetica, sans-serif; } canvas{ display: block; vertical-align: bottom; } /* ---- particles.js container ---- */ #particles-js{ position:absolute; width: 100%; height: 100%; background-color: #183f60; background-image: url(""); background-repeat: no-repeat; background-size: cover; background-position: 50% 50%; } /* ---- stats.js ---- */ .count-particles{ background: #000022; position: absolute; top: 48px; left: 0; width: 80px; color: #13E8E9; font-size: .8em; text-align: left; text-indent: 4px; line-height: 14px; padding-bottom: 2px; font-family: Helvetica, Arial, sans-serif; font-weight: bold; } .js-count-particles{ font-size: 1.1em; } #stats, .count-particles{ -webkit-user-select: none; margin-top: 5px; margin-left: 5px; } #stats{ border-radius: 3px 3px 0 0; overflow: hidden; } .count-particles{ border-radius: 0 0 3px 3px; } </style> </head> <body class="homedesktoptest"> <div id="particles-js"></div> <script src="https://cdn.jsdelivr.net/particles.js/2.0.0/particles.min.js"></script> <script> particlesJS("particles-js", {"particles":{"number":{"value":47,"density":{"enable":true,"value_area":552.4033491425909}},"color":{"value":"#ffffff"}, "shape":{"type":"circle","stroke":{"width":0,"color":"#000000"},"polygon":{"nb_sides":5},"image":{"src":"img/github.svg","width":100,"height":100}}, "opacity":{"value":0.5,"random":false,"anim":{"enable":false,"speed":1,"opacity_min":0.1,"sync":false}}, "size":{"value":3,"random":true,"anim":{"enable":false,"speed":40,"size_min":0.1,"sync":false}}, "line_linked":{"enable":true,"distance":150,"color":"#ffffff","opacity":0.4,"width":1}, "move":{"enable":true,"speed":6,"direction":"none","random":false,"straight":false,"out_mode":"out", "bounce":false,"attract":{"enable":false,"rotateX":600,"rotateY":1200}}},"interactivity":{"detect_on":"canvas", "events":{"onhover":{"enable":true,"mode":"grab"},"onclick":{"enable":true,"mode":"push"},"resize":true}, "modes":{"grab":{"distance":155.84415584415586,"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});var count_particles, stats, update; stats = new Stats; stats.setMode(0); stats.domElement.style.position = 'absolute'; stats.domElement.style.left = '0px'; stats.domElement.style.top = '0px'; document.body.appendChild(stats.domElement); count_particles = document.querySelector('.js-count-particles'); update = function() { stats.begin(); stats.end(); if (window.pJSDom[0].pJS.particles && window.pJSDom[0].pJS.particles.array) { count_particles.innerText = window.pJSDom[0].pJS.particles.array.length; } requestAnimationFrame(update); }; requestAnimationFrame(update);; </script> </body> </html>
Maybe you can help me to find the correct section or tell me what i did wrong on enfold.
Thanks in advance-
Kind regards!- This topic was modified 4 years, 9 months ago by marketingnr1.
January 30, 2020 at 4:57 am #1179680Hey marketingnr1,
Thank you for the update.
You shouldn’t include the html, head and body tag because those elements already exists. All you need is the particle-js container and the required scripts and styles.
// https://pastebin.com/isWaJhPj
Best regards,
IsmaelFebruary 3, 2020 at 12:19 pm #1180860Hello Ismael,
thanks for helping!
I copy/pasted your provided code without html, head and body but it still doesn´t work.
I cant find the correct particle-js container on this enfold site.
Are these all the particles-js which must be changed with the correct js cointainer path?:
<div id="particles-js"></div> particlesJS("particles-js")
Kind regards.
February 4, 2020 at 12:16 pm #1181239Hi,
Thank you for the update.
Did you include the particles-js container in a code or text block?
<div id="particles-js"></div>
We forgot to add it in pastebin.
Best regards,
IsmaelFebruary 4, 2020 at 4:02 pm #1181325Hello Ismael,
i included your hole code: https://pastebin.com/isWaJhPj in a code-block which is in the section Homedesktoptest
Kind regards!
February 5, 2020 at 10:03 am #1181674Hi,
Can you give us a link to the original source code? Where did you get the internal style?
We tried to fix the particleJS function but the specified parameters seems to be invalid, or there’s something missing from it. Did you edit it manually?
Best regards,
IsmaelFebruary 5, 2020 at 10:05 am #1181675Hello Ismael,
We edited only the background color of the animation.
Kind regards and thanks in advance!
- This reply was modified 4 years, 9 months ago by marketingnr1.
February 6, 2020 at 1:59 pm #1182013Hi Ismael,
now the animation is in the top background but shrinked into center.
This code works but only centered in this section on enfold:
How you can make this section full with on enflod? Did i take the wrong class?
<style> /* ---- reset ---- */ #top .homedesktoptest{ margin:0; font:normal 75% Arial, Helvetica, sans-serif; } canvas{ display: block; vertical-align: bottom; } /* ---- particles.js container ---- */ #particles-js{ position:absolute; width: 100%; height: 100%; background-color: #183f60; background-image: url(""); background-repeat: no-repeat; background-size: cover; background-position: 50% 50%; } /* ---- stats.js ---- */ .count-particles{ background: #000022; position: absolute; top: 48px; left: 0; width: 80px; color: #13E8E9; font-size: .8em; text-align: left; text-indent: 4px; line-height: 14px; padding-bottom: 2px; font-family: Helvetica, Arial, sans-serif; font-weight: bold; } .js-count-particles{ font-size: 1.1em; } #stats, .count-particles{ -webkit-user-select: none; margin-top: 5px; margin-left: 5px; } #stats{ border-radius: 3px 3px 0 0; overflow: hidden; } .count-particles{ border-radius: 0 0 3px 3px; } </style> <div id="particles-js"></div> <script src="https://cdn.jsdelivr.net/particles.js/2.0.0/particles.min.js"></script> <script> particlesJS("particles-js", {"particles":{"number":{"value":47,"density":{"enable":true,"value_area":552.4033491425909}},"color":{"value":"#ffffff"}, "shape":{"type":"circle","stroke":{"width":0,"color":"#000000"},"polygon":{"nb_sides":5},"image":{"src":"img/github.svg","width":100,"height":100}}, "opacity":{"value":0.5,"random":false,"anim":{"enable":false,"speed":1,"opacity_min":0.1,"sync":false}}, "size":{"value":3,"random":true,"anim":{"enable":false,"speed":40,"size_min":0.1,"sync":false}}, "line_linked":{"enable":true,"distance":150,"color":"#ffffff","opacity":0.4,"width":1}, "move":{"enable":true,"speed":6,"direction":"none","random":false,"straight":false,"out_mode":"out", "bounce":false,"attract":{"enable":false,"rotateX":600,"rotateY":1200}}},"interactivity":{"detect_on":"canvas", "events":{"onhover":{"enable":true,"mode":"grab"},"onclick":{"enable":true,"mode":"push"},"resize":true}, "modes":{"grab":{"distance":155.84415584415586,"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});var count_particles, stats, update; stats = new Stats; stats.setMode(0); stats.domElement.style.position = 'absolute'; stats.domElement.style.left = '0px'; stats.domElement.style.top = '0px'; document.body.appendChild(stats.domElement); count_particles = document.querySelector('.js-count-particles'); update = function() { stats.begin(); stats.end(); if (window.pJSDom[0].pJS.particles && window.pJSDom[0].pJS.particles.array) { count_particles.innerText = window.pJSDom[0].pJS.particles.array.length; } requestAnimationFrame(update); }; requestAnimationFrame(update);; </script>
- This reply was modified 4 years, 9 months ago by marketingnr1.
February 9, 2020 at 3:24 am #1182679Hi,
Glad to know that it’s working now. You can add this css code to adjust the width of the section container.
#homedesktoptest .container { max-width: 100% !important; width: 100%; padding: 0; }
Please note that homedesktoptest is the ID or Section ID of the color section containing the particle script.
Best regards,
IsmaelFebruary 10, 2020 at 12:45 pm #1183019Hi Ismael,
yes your css code works, but now the hole container is stretched also the text.
So thats not the correct solution for this enfold section. I am wondering why the code (without your css) is only showing in a small section while #homedesktop is a full with section on enfold.Provided link in private content.
Thanks in advance,
Kind regards!
February 11, 2020 at 2:13 pm #1183484Hi,
Thank you for following up.
Try to set the height of the particle canvas to auto to prevent it from getting distorted.
.particles-js-canvas-el { height: auto !important; }
Best regards,
IsmaelFebruary 11, 2020 at 4:46 pm #1183580Hello Ismael,
mh, with this code the animation is only a little bit above in the section.
And on mobile the container is also not full width :(you can also try this on the testing page if you need to.
I cant fix it.
Kind regards!
- This reply was modified 4 years, 9 months ago by marketingnr1.
February 14, 2020 at 5:57 am #1184389Hi,
mh, with this code the animation is only a little bit above in the section.
What do you mean by “above in the section”?
To make it full width on mobile view, please add this css code or combine it with the previous css declaration.
#homedesktoptest .container { width: 100% !important; max-width: 100% !important; }
Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.