阿西河

所有教程

公众号
🌙
阿西河前端的公众号

我的收藏

    最近访问  (文章)

      教程列表

      抓包专区
      测试专区

      插件 jQuery.jgrowl 中文API文档

      插件 jQuery.jgrowl 中文API文档 https://github.com/stanlemon/jGrowl

      jGrowl

      jGrowl is a jQuery plugin that raises unobtrusive messages within the browser, similar to the way that OS X’s Growl Framework works. The idea is simple, deliver notifications to the end user in a noticeable way that doesn’t obstruct the work flow and yet keeps the user informed.

      Installation

      jGrowl can be added to your project using package managers like bower and npm or directly into your html using cdnjs, as well as the good old fashioned copy-paste into your project directory.

      Use cdnjs:

      <link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/jquery-jgrowl/1.4.1/jquery.jgrowl.min.css" />
      <script src="//cdnjs.cloudflare.com/ajax/libs/jquery-jgrowl/1.4.1/jquery.jgrowl.min.js"></script>
      

      Install with bower

      bower install jgrowl
      

      Install with npm

      npm install jgrowl
      
      // Sample 1
      $.jGrowl("Hello world!");
      // Sample 2
      $.jGrowl("Stick this!", { sticky: true });
      // Sample 3
      $.jGrowl("A message with a header", { header: 'Important' });
      // Sample 4
      $.jGrowl("A message that will live a little longer.", { life: 10000 });
      // Sample 5
      $.jGrowl("A message with a beforeOpen callback and a different opening animation.", {
      	beforeClose: function(e,m) {
      		alert('About to close this notification!');
      	},
      	animateOpen: {
      		height: 'show'
      	}
      });
      

      Configuration Options

      OptionDefaultDescription
      pool0Limit the number of messages appearing at a given time to the number in the pool.
      headeremptyOptional header to prefix the message, this is often helpful for associating messages to each other.
      groupemptyA css class to be applied to notifications when they are created, useful for ‘grouping’ notifications by a css selector.
      stickyfalseWhen set to true a message will stick to the screen until it is intentionally closed by the user.
      positiontop-rightDesignates a class which is applied to the jGrowl container and controls its 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.
      appendTobodyThe element where our jGrowl messages are appended to. The default is body but feel free to define another one.
      glueafterDesignates whether a jGrowl notification should be appended to the container after all notifications, or whether it should be prepended to the container before all notifications. Options are after or before.
      themedefaultA CSS class designating custom styling for this particular message, intended for use with jQuery UI.
      themeStatehighlightA CSS class designating custom styling for this particular message and its state, intended for use with jQuery UI.
      corners10pxIf the corners jQuery plugin is include this option specifies the curvature radius to be used for the notifications as they are created.
      check250The frequency that jGrowl should check for messages to be scrubbed from the screen.This must be changed in the defaults before the startup method is called.
      life3000The lifespan of a non-sticky message on the screen.
      closeDurationnormalThe animation speed used to close a notification.
      openDurationnormalThe animation speed used to open a notification.
      easingswingThe easing method to be used with the animation for opening and closing a notification.
      closertrueWhether or not the close-all button should be used when more then one notification appears on the screen. Optionally this property can be set to a function which will be used as a callback when the close all button is clicked. This must be changed in the defaults before the startup method is called.
      closeTemplate×This content is used for the individual notification close links that are added to the corner of a notification. This must be changed in the defaults before the startup method is called.
      closerTemplate<div>[ close all ]</div>This content is used for the close-all link that is added to the bottom of a jGrowl container when it contains more than one notification. This must be changed in the defaults before the startup method is called.
      logfunction(e,m,o) {}Callback to be used before anything is done with the notification. This is intended to be used if the user would like to have some type of logging mechanism for all notifications passed to jGrowl. This callback receives the notification’s DOM context, the notification’s message and its option object.
      beforeOpenfunction(e,m,o) {}Callback to be used before a new notification is opened. This callback receives the notification’s DOM context, the notification’s message and its option object.
      afterOpenfunction(e,m,o) {}Callback to be used after a new notification is opened. This callback receives the notification’s DOM context, the notification’s message and its option object.
      openfunction(e,m,o) {}Callback to be used when a new notification is opened. This callback receives the notification’s DOM context, the notifications message and its option object.
      beforeClosefunction(e,m,o) {}Callback to be used before a new notification is closed. This callback receives the notification’s DOM context, the notification’s message and its option object.
      closefunction(e,m,o) {}Callback to be used when a new notification is closed. This callback receives the notification’s DOM context, the notification’s message and its option object.
      clickfunction(e,m,o) {}Callback to be used when a notification is clicked. This callback receives the notification’s DOM context, the notification’s message and its option object.
      animateOpen{ opacity: ‘show’ }The animation properties to use when opening a new notification (default to fadeOut).
      animateClose{ opacity: ‘hide’ }The animation properties to use when closing a new notification (defaults to fadeIn).
      目录
      目录