Monday, November 7, 2011

Hide div with setTimeout

[javascript]
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>hide div com setInterval</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.js"></script>
<script>
$(document).ready(function() {
function sumir_floater() {
var div = $("#floater");
div.fadeIn();
div.queue(function() {
setTimeout(function() {
div.dequeue();
}, 5000);
});
div.fadeOut("fast");
}

sumir_floater();

});
</script>
</head>

<body>
<div id="floater">
<p>Image or Text here</p>
</div>
</body>
</html>
[/javascript]

0 comments:

Post a Comment