Wednesday, February 19, 2014

How to Make DIV Appear & fade out at Certain Times in Accordance with The Time Specified

Copy code below and paste after <head>

<script type="text/javascript">
function showIt() {
document.getElementById("hid").style.display = "block";
}
setTimeout("showIt()",12000);
$(document).ready( function() {
        $('#hid').delay(1000).fadeOut();
      });

</script>

Place anywhere on  <body> or place on Layout Page ( add a gadget - html/javascript )

<div id="hid" style="width:200px;height:200px;opacity:0.1;background-color:orange;text-align:center;display:none;">
this is Loading & Fade Out DIV with timer
</div>

Note; always use the latest jquery
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js">
</script>


DEMO : wait a minute and it will show up div with orange background

No comments:

Post a Comment