Archived topic
Animated Background
5 replies · Started by Igor on January 29, 2022
Hi Guys!
I’m trying to put a css/js animated background on homepage full screen hero. This is the exactly one: https://codepen.io/deathfang/pen/WxNVoq
This didn't help: https://generatepress.com/forums/topic/adding-css-animated-background-on-header-element/
Whatever I do it goes outside of hero or I can't see it at all. Any help?
Thank you so much!
Hi there,
if you can share a link to your site where i can see it 'goes outside of hero' then i can take a look at what its doing.
Hi Igor,
The script you're using has an init function. This init function should have a line that tells the script where it adds the div.
Inside the init function function init(), you should see something like this line - document.body.appendChild(container);.
You should define the correct object instead of using document.body.
Example:
var pagehero = document.querySelector('.page-hero.home-hero');
pagehero.appendChild(container);
Thanks Elvin! It worked!
No problem. :D