Toastr.js notifications as modal notfication

Posted by Maxsteel on Stack Overflow See other posts from Stack Overflow or by Maxsteel
Published on 2014-08-25T10:06:38Z Indexed on 2014/08/25 10:20 UTC
Read the original article Hit count: 163

Filed under:
|
|
|
|

I know it's not what toastr (or toast notifs in general) are meant to be used for, but I want to use them as a modal notification. My idea is following.

On toast show:

toastr.options.onShown = function() { //Create an overlay on the entire page}

Overlay:

#overlay {
background-color: rgba(0, 0, 0, 0.8);
z-index: 999;
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
display: none;
}

And on toast close:

toastr.options.onHidden = function() { //make overlay go away }

Also, I'm setting timeout of toast to 0 so it won't disappear by itself.

Question: I want the toast notification to stay atop the overlay and not behind it as overlay will cover everything. How can I do it?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery