mouse0270 / bootstrap-notify

Turns standard Bootstrap alerts into "Growl-like" notifications.
http://bootstrap-notify.remabledesigns.com/
MIT License
2.25k stars 641 forks source link

closeAll does not flush the placement #33

Open ghost opened 10 years ago

ghost commented 10 years ago

Hello.

After using $.growl(false, {command: 'closeAll'}) a new one growl has a placement after the previous growl's position until the "delay" event.

mouse0270 commented 10 years ago

So if you were to call a closeAll and then a new growl it would be positioned to far down, is that what you are saying?

ghost commented 10 years ago

Yes, exactly.

mouse0270 commented 10 years ago

I am going to be working on the plugin this weekend. I'll add this to the list of things I have to do! Thank you very much for letting me know.

ghost commented 10 years ago

Thank you very much for your working and plugin! ^_^

leodutra commented 10 years ago

Any update on this? I'm on a rush, and I cannot stop to fix it now. Does anyone have a (personal) solution?

Thanks.

mouse0270 commented 10 years ago

I have been working on this issue, it is actually one of the reasons I haven't updated the plugin. I am sorry that I do not have an update for when this may be completed though.

mouse0270 commented 10 years ago

Actually, hold that thought. Please check back tomorrow I think I may have a solution. If I add a class such as growl-closing to the closing growls then when I am determine the position for new growls I only check for growls that do not have the class growl-closing

This is just an idea, I have to test it out.

ghost commented 10 years ago

LeoDutra, instead of

return offsetAmt = Math.max(offsetAmt, parseInt($(this).css(settings.placement.from)) + $(this).outerHeight() + settings.spacing);

I use

return offsetAmt;

152 line. ;) But it's a workaround for my needs. May be it will be useful for you too.

mouse0270 commented 10 years ago

su-bzero, but wouldn't that not stop you from stacking growls notifications?

ghost commented 10 years ago

mouse0270, I keep only one notification for a moment. ;) So yes, it's a dirty hack, but it allowed me to complete my project already.

leodutra commented 10 years ago

Looks like there's a fork fixing it with an option: https://github.com/nickrussler/bootstrap-growl-1/commit/42812090b75264ce48d1282adc7222cac1ca0349 (nop, It did not help)

And thank you @su-bzero.

Thank God, you guys are fast.

I'll surely help you on this nice project, on my spare time.

leodutra commented 10 years ago

Hum... @su-bzero wins. His tip solved. "Outstanding"

mouse0270 commented 10 years ago

Please just keep in mind that using that technique you will not be able to display more then one growl in each position.

leodutra commented 10 years ago

Right.

abobwhite commented 10 years ago

I am also having this issue. It's not terrible but would be nice to make sure the positioning resets. Maybe the closeAll should stop any jQuery animations so that there isn't a placement delay?

leodutra commented 10 years ago

I'm using this:

closeAll = function(options) {
    // HACKED force
    var containers = $('[data-growl="container"]').hide();  
    containers.css('top', -containers.outerHeight());
    if (!options) {
        $('[data-growl="container"]').find('[data-growl="dismiss"]').trigger('click');
    }else{
        $('[data-growl="container"][data-growl-position="'+options+'"]').find('[data-growl="dismiss"]').trigger('click');
    }
}