How To Delay Display Of Bootstrap 3 Modal After Click
I'm trying to delay the display of a Bootstrap modal after the user has clicked on a trigger button:
Solution 2:
Use .on()
to hook into the event:
var isFirstShowCall = false;
$('#myModal').on('show.bs.modal', function (e) {
isFirstShowCall = !isFirstShowCall; // Prevents an endless recursive call
if(isFirstShowCall) {
e.preventDefault(); // Prevent immediate opening
window.setTimeout(function(){
$('#myModal').modal('show');
}, 3000)
}
});
Copy
Solution 3:
window.setTimeout(function() {
$('#myModal').modal('show');
}, 5000)
Copy
For demo I used 5000 mini seconds. You can used it as per your need...
Solution 4:
If any of those above method does't work, give this method a try. It will work perfectly.
$(window).ready(function() {
setTimeout(function(){
$('#myModal').modal('show');
}, 2000);
});
Copy
Post a Comment for "How To Delay Display Of Bootstrap 3 Modal After Click"