Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery jgrowl position

Tags:

jquery

jgrowl

If in jgrowl.css the position is changed to 'center', how do I override this to default i.e, 'top-right'

$.jGrowl(data, { 
     header: 'data',
     animateOpen: { height: 'show'}, 
     life: 10000,
     position:'top-right'
});

Currently, Position doesn't work right now in the above

Thanks..

like image 708
Hulk Avatar asked Feb 18 '10 14:02

Hulk


2 Answers

According to the jGrowl Options documentation for the position option

Designates a class which is applied to the jGrowl container and controls it's position on the screen. By Default there are five options available, top-left, top-right, bottom-left, bottom-right, center. This must be changed in the defaults before the startup method is called.

To do this, you'll have something like

    <script type="text/javascript">
           $.jGrowl.defaults.position = 'top-right';
    </script>

Then you can make your call as above and omit the position setting. Judging from the jGrowl docs, you HAVE to set the position by default and my quick tests confirmed that setting the position in your $.jGrowl(...) call, has no effect.

Hope that helps

like image 190
Kamal Avatar answered Oct 03 '22 06:10

Kamal


If you want different notifications located in different positions you will need to create separate notification containers.

Furthermore, if you have separate containers you will also need to use the selector form of calling jGrowl, rather then the short-hand wrapper.

ie. $('#my-container').jGrowl('my notification...');

like image 35
stanlemon Avatar answered Oct 03 '22 05:10

stanlemon