开发者

jquery jrowl size

开发者 https://www.devze.com 2022-12-20 20:17 出处:网络
How to set the jgrowl size to be as auto.Because if the the contents are more i thinks it wraps up the content.

How to set the jgrowl size to be as auto.Because if the the contents are more i thinks it wraps up the content. can we set this som开发者_JAVA技巧ething like

<script>
$.jGrowl.defaults.size = 'auto';
</script>

Thanks.


There does not appear to be any public methods for setting the width of the growl itself. Your best option may be to go into the css file itself, and change it from ~235px to something larger. Note that this isn't really solving a problem. In reality, causing long text to wrap is (generally speaking) the ideal behavior.

You may also be able to add some logic to the beforeOpen() method that estimates the width of an unwrapped child, and adjusts the width of that particular growl.


I have done this using the beforeOpen callback as follows:

$.jGrowl( "your message here", {
      life: 3000,
      easing: "swing",
      position: 'bottom-left',
      beforeOpen: function(e,m,o){
          $(e).width( "550px" ).height("108px");
      }
 });

Note that e refers to the container element that encloses your message. Therefore the above code does not set the size of the popup window itself but the content of the popup window. The popup window resizes appropriately to accommodate its content.

0

精彩评论

暂无评论...
验证码 换一张
取 消