Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toastr Container #375

Closed
tbragaf opened this issue Nov 8, 2015 · 15 comments
Closed

Toastr Container #375

tbragaf opened this issue Nov 8, 2015 · 15 comments

Comments

@tbragaf
Copy link

tbragaf commented Nov 8, 2015

Hi all!

It seems to me that after a toast is rendered (and then disappears) the container also disappears with it.
And, after that, my old container stops existing, and following toasts will render inside the default container with fixed position.

Is there anything I should be aware of?

Stay awesome,
tbragaf

@appjitsu
Copy link

I have the same issue.

https://github.com/CodeSeven/toastr/blob/master/toastr.js

line 422:

$container.remove();

I believe that is the issue.

#378

@tbragaf
Copy link
Author

tbragaf commented Nov 10, 2015

I hacked this behaviour with an empty span inside the container xD

@appjitsu
Copy link

@tbragaf hah nice!

@acshef
Copy link

acshef commented Nov 10, 2015

The container should be RECREATED once a new toast appears. Specifically, the toastr.xxxxxx() functions will internally call the notify() function. Within notify(), it gets the container using the internal function getContainer(options,true). The second parameter being true means that it will first try to find an existing container, and if not then it will create the container and return that.

@TimFerrell
Copy link
Member

This isn't an issue - the container is removed by design once there are no remaining toasts.

@tbragaf
Copy link
Author

tbragaf commented Nov 11, 2015

@TimFerrell So how can I achieve my purpose?

@TimFerrell
Copy link
Member

What's your problem, specifically?

@tbragaf
Copy link
Author

tbragaf commented Nov 14, 2015

@TimFerrell I don't want the container to disappear from my div element.
I only managed to do that by spawning a span element inside the container, which is an ugly hack.

@TimFerrell
Copy link
Member

Why are you trying to prevent the container from closing?

@tbragaf
Copy link
Author

tbragaf commented Nov 14, 2015

@TimFerrell because I want the toasts to always appear inside it.

@TimFerrell
Copy link
Member

The container will recreate itself automatically. Maybe I'm not asking the right questions here but can you please explain why you don't want this to happen?

@tbragaf
Copy link
Author

tbragaf commented Nov 15, 2015

In my sample, the container recreates at the default position: body
And I need it inside another tag

@TimFerrell
Copy link
Member

Sorry for the slow response. You can specify the element that the container appears within - is that not happening for you?

@tbragaf
Copy link
Author

tbragaf commented Nov 23, 2015

@TimFerrell How so?

I tried with:

<div id="toast-container">
    <!-- Only way to prevent the destruction -->
    <span></span>
</div>

@JasonLawrenceDuncan
Copy link

I ran into this same issue today. @tbragaf 's hack does work, but this sure seems like a bug to me. If the user provides a "target", you shouldn't delete it (or at least add an option to override deletion). I want to position the container relative to a parent div, not have it be dynamically injected at the bottom of the DOM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants