I took notify.js to solve and I have a problem of adding notifications in the VISIBLE area of ​​the browser window, that is, I want to display a notification in the lower left corner of the window (although there is still a scroll below) or in the upper right corner. Once again, how can I display a notification on top of my body in the visible part of the window? Thank.

At the moment, a notification is displayed in the body body and accordingly at the very bottom of the blocks: (

 $('body').notify( "Notification, Success", { position:"left-bottom" } ); 

https://notifyjs.com/ Notification API

Notification API don't want to use the Notification API for the reason that the user can ignore the choice to enable or disable notification on the site. Therefore, the similarity of notify.js practical.

  • add a link to the library you use - Grundy
  • Added, and updated on your answer. - Zimzibar
  • why it is necessary on the body element, but not globally? - Grundy
  • yes you can just $ .notify .... there is no difference - Zimzibar
  • actually there is. - Grundy

2 answers 2

As I understand it, the position is indicated with a space

  { position:"left bottom" } 

So, the fact that you call a function from the body is also wrong:

 $.notify( "Notification", { position:"left bottom" } ); 

The type of notification notation is also incorrect, it requires separate quotes:

 $.notify( "Notification", "success", { position:"left bottom" } ); 

    Through trial and error I achieved ALMOST the desired effect:

     $('body').notify( "Notification, Success", { position:"left-bottom" }).offset({top: 0, left 1000}); 

    Those. the display will be TOP and not dependent on the scroll, i.e. will always be at the coordinates above on the right above. What other solutions are there? I don't like this method very much, but at least it works. And with this method, an error appears supposedly offset is not a function :(

    • one
      if an error occurs, then the solution does not work - Grundy
    • Everything works fine, I figured it out myself, even though the time was gone, and you write more specifically, and not flood. I close the question. - Zimzibar
    • one
      error supposedly offset is not a function - hints that if you remove the call to offset, nothing will change, only the error will disappear. Therefore, the above code is no different from that. what was in question. - Grundy
    • Just write one of the solutions, and if you don’t believe me and base yourself on the theory, just run along with this plugin and create a simple div. The result will surprise you! good luck It is strange that they scored a high rating, because you are wrong. - Zimzibar 6:49
    • one
      No one is insured against delusions. The duty to provide a minimal reproducible example lies with the author of the question, so that you can see what exactly is wrong with him. - Grundy