Permalink
Browse files

* added 'gritter-light' option for a class_name

* added global $.gritter.options.class_name
  • Loading branch information...
Jordan Boesch
Jordan Boesch committed Dec 8, 2011
1 parent a927a2c commit 4a94f2e5fc012478e491ef87355174f0ffa7b216
Showing with 32 additions and 9 deletions.
  1. +5 −0 README.markdown
  2. BIN images/gritter-light.png
  3. +19 −2 index.html
  4. +5 −4 js/jquery.gritter.js
  5. +3 −3 js/jquery.gritter.min.js
View
@@ -5,6 +5,11 @@ A small growl-like notification plugin for jQuery
## Change Log
+### Changes in 1.7.3 (December 8, 2011)
+
+* Added $.gritter.options.class_name option
+* Added 'gritter-light' class_name option to use light messages instead of dark ones
+
### Changes in 1.7.2 (December 2, 2011)
* Added option to return false on "before_open" callback to determine whether or not to show the gritter message (good for setting a max)
View
Binary file not shown.
View
@@ -6,7 +6,7 @@
<link rel="stylesheet" type="text/css" href="css/jquery.gritter.css" />
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">google.load('jquery', '1.7.1');</script>
-<script type="text/javascript" src="js/jquery.gritter.min.js"></script>
+<script type="text/javascript" src="js/jquery.gritter.js"></script>
<style type="text/css">
body {
background:#222 url(images/trees.jpg);
@@ -36,11 +36,14 @@ <h1>Gritter Demo</h1>
<a href="#" id="add-regular">Add regular notification</a>: Fades out after a certain amount of time, can be set for each notification.
</li>
<li>
- <a href="#" id="add-sticky">Add sticky notification</a>: Doesn't run on a fade timer. Just sits there until the user manually removes it by clicking on the (X)
+ <a href="#" id="add-sticky">Add sticky notification</a>: Doesn't run on a fade timer. Just sits there until the user manually removes it by clicking on the (X).
</li>
<li>
<a href="#" id="add-without-image">Add notification without image</a>
</li>
+ <li>
+ <a href="#" id="add-gritter-light">Add a white notification</a>: has a 'gritter-light' class_name applied to it.
+ </li>
<li>
<a href="#" id="add-with-callbacks">Add notification (with callbacks)</a>
</li>
@@ -66,6 +69,7 @@ <h1>Gritter Demo</h1>
// global setting override
/*
$.extend($.gritter.options, {
+ class_name: 'gritter-light', // for light notifications (can be added directly to $.gritter.add too)
position: 'bottom-left', // possibilities: bottom-left, bottom-right, top-left, top-right
fade_in_speed: 100, // how fast notifications fade in (string or int)
fade_out_speed: 100, // how fast the notices fade out
@@ -162,6 +166,19 @@ <h1>Gritter Demo</h1>
return false;
});
+ $('#add-gritter-light').click(function(){
+
+ $.gritter.add({
+ // (string | mandatory) the heading of the notification
+ title: 'This is a light notification',
+ // (string | mandatory) the text inside the notification
+ text: 'Just add a "gritter-light" class_name to your $.gritter.add or globally to $.gritter.options.class_name',
+ class_name: 'gritter-light'
+ });
+
+ return false;
+ });
+
$('#add-with-callbacks').click(function(){
$.gritter.add({
View
@@ -5,8 +5,8 @@
* Copyright (c) 2011 Jordan Boesch
* Dual licensed under the MIT and GPL licenses.
*
- * Date: December 2, 2011
- * Version: 1.7.2
+ * Date: December 8, 2011
+ * Version: 1.7.3
*/
(function($){
@@ -21,6 +21,7 @@
*/
$.gritter.options = {
position: '',
+ class_name: '', // could be set to 'gritter-light' to use white notifications
fade_in_speed: 'medium', // how fast notifications fade in
fade_out_speed: 1000, // how fast the notices fade out
time: 6000 // hang on the screen for...
@@ -63,7 +64,7 @@
/**
* Big fat Gritter object
- * @constructor (not really since it's object literal)
+ * @constructor (not really since its object literal)
*/
var Gritter = {
@@ -103,7 +104,7 @@
text = params.text,
image = params.image || '',
sticky = params.sticky || false,
- item_class = params.class_name || '',
+ item_class = params.class_name || $.gritter.options.class_name,
position = $.gritter.options.position,
time_alive = params.time || '';
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit 4a94f2e

Please sign in to comment.