Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
178
rated 0 times [  182] [ 4]  / answers: 1 / hits: 66778  / 10 Years ago, wed, may 14, 2014, 12:00:00

I thought something like this might work but it's not giving me exactly what i need.



Here's what I'm trying right now.



<style type=text/css>
#overlay
{
display:none;
}
</style>
<script>
$( document ).ready(function(){
$('#overlay').fadeIn('fast').delay(15000).fadeOut('fast');
});
</script>
<div id=overlay>
<script>
$(function () {
$('a').click(function(){
window.open('/getting-started/feg-top-performers','mywindow','width=400,height=200,toolbar=yes,
location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,
resizable=yes')
});
});
</script>
</div>


Basically as soon as the page opens I want to populate an entire html page and than have that page (the popup) fade out after 5 seconds.



Any help would be greatly appreciated. Thank you.


More From » jquery

 Answers
11

Create a very simple Bootstrap modal, then set a timeout for when you would like it to hide. Bootstrap Modals look fantastic and are very customizable. They also have great fade in and out animations. View all the documentation along with the events, methods and options HERE.



jQuery:



$('#overlay').modal('show');

setTimeout(function() {
$('#overlay').modal('hide');
}, 5000);


HTML:



<div class=modal fade id=overlay>
<div class=modal-dialog>
<div class=modal-content>
<div class=modal-header>
<button type=button class=close data-dismiss=modal aria-hidden=true>&times;</button>
<h4 class=modal-title>Modal title</h4>
</div>
<div class=modal-body>
<p>Context here</p>
</div>
</div>
</div>
</div>


WORKING DEMO



PS. Don't forget to also include both bootstrap.js and bootstrap.css within your project if you would like to go down this path. You can use the remote CDN files HERE, or download them and include them within your project HERE.


[#71007] Tuesday, May 13, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
mckaylab

Total Points: 311
Total Questions: 120
Total Answers: 93

Location: Montenegro
Member since Thu, Jun 16, 2022
2 Years ago
;