jqMessageBar icon indicating copy to clipboard operation
jqMessageBar copied to clipboard

Auto hide message bar after some interval

Open mindscratch opened this issue 13 years ago • 3 comments

For use cases where generally only a single message is shown, it would be helpful to be able to have the message bar auto-hide after some interval.

mindscratch avatar Jun 28 '11 10:06 mindscratch

I'm no Javascript expert (or intermediate, or... well, any good really) but, perhaps:

function DelayedHide() { $('body').messagebar('hide'); } function DelayHide() { setTimeout("DelayedHide()", 3000); }

JonTheNiceGuy avatar Jul 13 '11 08:07 JonTheNiceGuy

@JonTheNiceGuy -- you're on the right track. jQuery provides the ability to "hide" (and show) components and even use various effects while doing it. In fact, I'm already doing this when the messagebar is shown and hidden.

What I'm looking to do is make the messagebar hide itself after displaying a message for some amount of time. The current implementation was designed such that the user is expected to click on the messagebar to get rid of it when they're ready to. I'd like to provide the ability for it to do that on its own (per the configuration by the developer using it), make sense?

mindscratch avatar Jul 13 '11 10:07 mindscratch

That's what the "DelayHide()" function is there for. It'll run the "DelayedHide()" function after 3000ms.

JonTheNiceGuy avatar Jul 20 '11 09:07 JonTheNiceGuy