Skip to content
Advertisement

CSS welcome animation overflow

I have this snippet. The welcome div is for a welcome animation on the page that lasts 3.5 seconds and then disappears.

The problem is that the overflow is visible, being able to see the elements that I would like to be visible only after the welcome animation is finished. As a solution to this problem, I thought of javascript, inserting another function for setTimeOut for body with hidden overflow

setTimeout (function () { document.querySelector (‘. body’). style.overflow = ‘hidden’;

}, 3500);

But it does not work. I want the animation to last x seconds and then all the elements of the page to be visible, not during the animation. Do you have solutions? Is this method as effective for a beginning animation as other modern sites have?

JavaScript
JavaScript
JavaScript

Advertisement

Answer

Just wrap the content you want to appear after, inside a div or section (say, with an id #mainContent) and initially set its’s display to none. When you change the display of .welcome to none, you can also change the display of #mainContent to block like this:

JavaScript
JavaScript
JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement