So I have an app using bootstrap and it's alerts when you sign in, sign out etc..
I'm having trouble getting this pop up to close automatically, within 5 seconds, the class I've used to style the alert box is ".alert" and ".alert-info".
I've tried adding the following code to application.js:
window.setTimeout(function() {
$(".alert alert-info").fadeTo(500, 0).slideUp(500, function(){
$(this).remove();
});
}, 5000);
In addition to adding it in a script tag in application.html.erb
<script>
window.setTimeout(function() {
$(".alert alert-info").fadeTo(500, 0).slideUp(500, function(){
$(this).remove();
});
}, 5000);
</script>
But it still doesn't seem to be closing automatically, what am I doing wrong?
Thanks!