I'm looking for a way to keep a css alert message focused on all situations.
The situation is this:
I have two tables that have the option to be minimized, and at the end a submit button. By pressing the sumbit button if there is an error, a floating message appears (with the toastr library), which reports the error. The problem is that if I scroll, or minimize the tables, and the structure of the page changes me and pressing the submit, the error message does not necessarily remain at the center as defined, but above or below, since it does not maintain the same pixels or change the layout of the screen to say one way.
In what way could you always send the message to the center of the screen, regardless of the view you have?
The way to set the position that I currently have is:
toastr.options.positionClass = 'toast-center';
the message
toastr.warning('No existen Tramites al cual asociar.');
the css
.toast-center {
top: 500px;
margin: 0 auto;
left: 35%;
}
I do not put all the code because it is long and what calls the message has no relevance to the style itself, but is more than anything because as the submit button is in the background, generates the message in the center of what you see, but if I minimize a table as in the second image, I still reach to press the button but it generates the alert in the same place as at the beginning and not in the new screen center.
In other words, always the message is located at the center of the screen that was generated in the recharge according to its measurements, if from there I see the top, or reduce elements, it does not fit the center of what I am seeing , but keeps sending the message to the center of the original size.
If I minimize or scrolling upwards, it stays that way