Lewis Day Lewis Day - 5 months ago 37
CSS Question

Hide one div and show another?

I have two

on called
and one called

<div id="loading"></div>
<div id="main"></div>

What I'm trying to achieve is with using javascript, show
for five seconds then after the five seconds hide the
div and show the
div. The
div is default hidden and once the
div is hidden the
div shows.

I'm assuming that to achieve this would be a mixture of css and javascript; hopefully you understand what I'm trying to achieve and can help me accomplish what I'm trying to achieve.



Your css would be:

#main {

The JS would be:

setTimeout(function() {
    document.getElementById('main').style.display = 'block';
    document.getElementById('loading').style.display = 'none';
}, 5000);