23
rated 0 times
[
24]
[
1]
/ answers: 1 / hits: 21914
/ 11 Years ago, sun, may 12, 2013, 12:00:00
I'm trying to delay showing a Bootstrap modal until 5 seconds have passed. Here is the section of my code. It seems write from what I have read on MDN. The modal does not appear after any amount of time. Any help would be appreciated.
var timeout;
function modalAlert(message){
$(#myModalLabel).text(Hey Look!)
$('.modal-body').html(<img src='+message+'>);
timeout = window.setTimeout(showModal,5000);
}
function showModal(){
console.log(HERE)
$(#myModal).modal('show')
}
Vijay Ramamurthy helped me find the solution:
var timeout;
function modalAlert(message){
$(#myModalLabel).text(Hey Look!)
$('.modal-body').html(<img src='+message+'>);
window.setTimeout(function(){showModal();},5000);
}
function showModal(){
console.log(HERE)
$(#myModal).modal('show')
}
More From » jquery