function loader_bar(msg,msgtype) {
switch (msgtype) {
case 'error':
$class = 'bar_error topbar'
break;
case 'success':
$class = 'bar_success topbar'
break;
case 'working':
$class = 'topbar'
msg = 'Spinner ' + msg
break;
default:
$class = 'topbar'
msg = msg
break;
}
if ($("#loader_bar").is(":visible")) {
$("#loader_bar").removeClass()
clearInterval(int);
$("#loader_bar").html(msg).addClass($class);
} else {
$('<div />', { "class": $class, html: msg, "id" : "loader_bar" }).prependTo("body").slideDown('fast');
}
myTimer = setInterval($("#loader_bar").slideUp('fast'), 10000);
}
Right now, it appears for a split second then goes?
Basically I want a bar to appear with a certain class when I call it, after 10 seconds I want it to slideUp however if it is called again from another function before the timeout. I want to reset the timer and change the message / class and keep it up another 10 seconds…
should be
The statement to run must be in a function, otherwise it would be called instantly.