jquery jgrowl position
Asked Answered
M

2

11

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..

Memnon answered 18/2, 2010 at 14:40 Comment(0)
U
24

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

Uncouple answered 18/2, 2010 at 15:45 Comment(1)
Hi,Thanks for that wonderful explaination. But i use jgrowl to be in the center also and also in the same application i want to use it in a different positio i.e, top-right,will this be applicable in this case also?Memnon
S
4

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...');

Saguaro answered 11/8, 2011 at 1:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.