Auto hide and show tag code with javascript

Yepkoo

Yepkoo
Staff member
Hide code, The number indicates after how many seconds the div will be hidden.
JavaScript:
setTimeout(function() {$(".hide_div").fadeOut(); }, 5000);

Show code, shows after how many seconds the number div will be visible.
JavaScript:
setTimeout(function() {$(".show_div").fadeIn(); }, 10000);

For example, by making style="display:block" in your div tag, you hide it on the first opening of the page.
You can make it visible again within the specified time with the visible code.

HTML:
<!--Example-->

<div class="show_div" style="display:none;">
   This message will appear after 5 seconds. 
</div>

<div class="hide_div">
    This message will be hidden after 10 seconds.
</div>
 
Top