0
$('body').prepend('<div class="alert alert-warning newalert" style="width: 100%;height: 50px;position:relative;z-index: 999999999;"><strong>'+message+'</strong></div>');

I am appending a div to the body when a method is called.

I am able to bring the div on top of all elements, but when the page is scrolled to the bottom and that method is called the alert div cannot be seen since its prepend to the body.

Is there a way in css where i can show the alert as a popup over every element and not scroll to the top to see it.

Hudhaifa Yoosuf
  • 869
  • 2
  • 12
  • 28

1 Answers1

0

position: fixed is what you need. see this

https://jsfiddle.net/4hz53umm/

Edmund Lee
  • 2,514
  • 20
  • 29