example jquery show element with setTimeout
example jquery show element with setTimeout
by Adi Jaya
HTML
<p>
Wait 10 second
</p>
<div class="fixed hide" id="refresh">
<div class="isi bg-red">
<p class="txt-white">
Lorem Ipsum .......................
</p>
<h2 class="txt-white">Recomended Article :</h2>
<ol class="txt-wheat">
<li>Lorem Ipsum ......</li>
<li>Lorem Ipsum ......</li>
<li>Lorem Ipsum ......</li>
<li>Lorem Ipsum ......</li>
</ol>
or refresh this Page <button>Refresh</button>
</div>
</div>
CSS
.hide {
display :none
}
.fixed{
position: fixed;
z-index: 2000;
background: black;
top: 0;
left: 0;
right: 0;
height: 100%;
}
.isi {
position: relative;
width: 80%;
margin: 0 auto;
top: 50px;
padding: 25px;
}
.bg-red {background:red;}
.txt-white{color :white;}
.txt-wheat{color :wheat;}
JavaScript
$(document).ready(function () {
timer = setTimeout(function () {
$('#refresh').removeClass('hide');
}, 10000);//10000 = 10 second
});