Lewis Day Lewis Day - 1 year ago 91
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.


Answer Source

Your css would be:

#main {

The JS would be:

setTimeout(function() {
    document.getElementById('main').style.display = 'block';
    document.getElementById('loading').style.display = 'none';
}, 5000);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download