Skip to content

Commit

Permalink
* added 'gritter-light' option for a class_name
Browse files Browse the repository at this point in the history
* added global $.gritter.options.class_name
  • Loading branch information
Jordan Boesch committed Dec 8, 2011
1 parent a927a2c commit 4a94f2e
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 9 deletions.
5 changes: 5 additions & 0 deletions README.markdown
Expand Up @@ -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)
Expand Down
Binary file added images/gritter-light.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 19 additions & 2 deletions index.html
Expand Up @@ -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);
Expand Down Expand Up @@ -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>
Expand All @@ -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
Expand Down Expand Up @@ -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({
Expand Down
9 changes: 5 additions & 4 deletions js/jquery.gritter.js
Expand Up @@ -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($){
Expand All @@ -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...
Expand Down Expand Up @@ -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 = {

Expand Down Expand Up @@ -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 || '';

Expand Down
6 changes: 3 additions & 3 deletions js/jquery.gritter.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4a94f2e

Please sign in to comment.