bootstrap-notify icon indicating copy to clipboard operation
bootstrap-notify copied to clipboard

closeAll does not flush the placement

Open ghost opened this issue 11 years ago • 16 comments

Hello.

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

ghost avatar Sep 12 '14 08:09 ghost

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?

mouse0270 avatar Sep 12 '14 11:09 mouse0270

Yes, exactly.

ghost avatar Sep 12 '14 11:09 ghost

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.

mouse0270 avatar Sep 12 '14 11:09 mouse0270

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

ghost avatar Sep 12 '14 11:09 ghost

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

Thanks.

leodutra avatar Nov 05 '14 13:11 leodutra

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 avatar Nov 05 '14 13:11 mouse0270

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.

mouse0270 avatar Nov 05 '14 13:11 mouse0270

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.

ghost avatar Nov 05 '14 13:11 ghost

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

mouse0270 avatar Nov 05 '14 13:11 mouse0270

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.

ghost avatar Nov 05 '14 13:11 ghost

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 avatar Nov 05 '14 13:11 leodutra

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

leodutra avatar Nov 05 '14 13:11 leodutra

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

mouse0270 avatar Nov 05 '14 14:11 mouse0270

Right.

leodutra avatar Nov 05 '14 15:11 leodutra

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?

abobwhite avatar Nov 14 '14 15:11 abobwhite

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');
    }
}

leodutra avatar Nov 14 '14 19:11 leodutra