author | Madhusudan.C.S <madhusudancs@gmail.com> |
Fri, 14 Aug 2009 11:07:24 +0530 | |
changeset 49 | 33c54f815fd5 |
parent 23 | 91cf6872d853 |
permissions | -rw-r--r-- |
23
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1 |
/** |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2 |
* jquery.purr.js |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3 |
* Copyright (c) 2008 Net Perspective (net-perspective.com) |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4 |
* Licensed under the MIT License (http://www.opensource.org/licenses/mit-license.php) |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5 |
* |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6 |
* @author R.A. Ray |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7 |
* @projectDescription jQuery plugin for dynamically displaying unobtrusive messages in the browser. Mimics the behavior of the MacOS program "Growl." |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8 |
* @version 0.1.0 |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9 |
* |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
10 |
* @requires jquery.js (tested with 1.2.6) |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
11 |
* |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
12 |
* @param fadeInSpeed int - Duration of fade in animation in miliseconds |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
13 |
* default: 500 |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
14 |
* @param fadeOutSpeed int - Duration of fade out animationin miliseconds |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
15 |
default: 500 |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
16 |
* @param removeTimer int - Timeout, in miliseconds, before notice is removed once it is the top non-sticky notice in the list |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
17 |
default: 4000 |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
18 |
* @param isSticky bool - Whether the notice should fade out on its own or wait to be manually closed |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
19 |
default: false |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
20 |
* @param usingTransparentPNG bool - Whether or not the notice is using transparent .png images in its styling |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
21 |
default: false |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
22 |
*/ |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
23 |
|
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
24 |
( function( $ ) { |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
25 |
|
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
26 |
$.purr = function ( notice, options ) |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
27 |
{ |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
28 |
// Convert notice to a jQuery object |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
29 |
notice = $( notice ); |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
30 |
|
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
31 |
// Add a class to denote the notice as not sticky |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
32 |
if ( !options.isSticky ) |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
33 |
{ |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
34 |
notice.addClass( 'not-sticky' ); |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
35 |
}; |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
36 |
|
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
37 |
// Get the container element from the page |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
38 |
var cont = document.getElementById( 'purr-container' ); |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
39 |
|
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
40 |
// If the container doesn't yet exist, we need to create it |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
41 |
if ( !cont ) |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
42 |
{ |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
43 |
cont = '<div id="purr-container"></div>'; |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
44 |
} |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
45 |
|
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
46 |
// Convert cont to a jQuery object |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
47 |
cont = $( cont ); |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
48 |
|
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
49 |
// Add the container to the page |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
50 |
$( 'body' ).append( cont ); |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
51 |
|
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
52 |
notify(); |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
53 |
|
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
54 |
function notify () |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
55 |
{ |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
56 |
// Set up the close button |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
57 |
var close = document.createElement( 'a' ); |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
58 |
$( close ).attr( |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
59 |
{ |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
60 |
className: 'close', |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
61 |
href: '#close', |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
62 |
innerHTML: 'Close' |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
63 |
} |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
64 |
) |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
65 |
.appendTo( notice ) |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
66 |
.click( function () |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
67 |
{ |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
68 |
removeNotice(); |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
69 |
|
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
70 |
return false; |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
71 |
} |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
72 |
); |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
73 |
|
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
74 |
// Add the notice to the page and keep it hidden initially |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
75 |
notice.appendTo( cont ) |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
76 |
.hide(); |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
77 |
|
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
78 |
if ( jQuery.browser.msie && options.usingTransparentPNG ) |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
79 |
{ |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
80 |
// IE7 and earlier can't handle the combination of opacity and transparent pngs, so if we're using transparent pngs in our |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
81 |
// notice style, we'll just skip the fading in. |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
82 |
notice.show(); |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
83 |
} |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
84 |
else |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
85 |
{ |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
86 |
//Fade in the notice we just added |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
87 |
notice.fadeIn( options.fadeInSpeed ); |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
88 |
} |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
89 |
|
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
90 |
// Set up the removal interval for the added notice if that notice is not a sticky |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
91 |
if ( !options.isSticky ) |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
92 |
{ |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
93 |
var topSpotInt = setInterval( function () |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
94 |
{ |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
95 |
// Check to see if our notice is the first non-sticky notice in the list |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
96 |
if ( notice.prevAll( '.not-sticky' ).length == 0 ) |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
97 |
{ |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
98 |
// Stop checking once the condition is met |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
99 |
clearInterval( topSpotInt ); |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
100 |
|
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
101 |
// Call the close action after the timeout set in options |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
102 |
setTimeout( function () |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
103 |
{ |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
104 |
removeNotice(); |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
105 |
}, options.removeTimer |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
106 |
); |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
107 |
} |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
108 |
}, 200 ); |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
109 |
} |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
110 |
} |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
111 |
|
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
112 |
function removeNotice () |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
113 |
{ |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
114 |
// IE7 and earlier can't handle the combination of opacity and transparent pngs, so if we're using transparent pngs in our |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
115 |
// notice style, we'll just skip the fading out. |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
116 |
if ( jQuery.browser.msie && options.usingTransparentPNG ) |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
117 |
{ |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
118 |
notice.css( { opacity: 0 } ) |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
119 |
.animate( |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
120 |
{ |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
121 |
height: '0px' |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
122 |
}, |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
123 |
{ |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
124 |
duration: options.fadeOutSpeed, |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
125 |
complete: function () |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
126 |
{ |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
127 |
notice.remove(); |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
128 |
} |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
129 |
} |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
130 |
); |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
131 |
} |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
132 |
else |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
133 |
{ |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
134 |
// Fade the object out before reducing its height to produce the sliding effect |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
135 |
notice.animate( |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
136 |
{ |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
137 |
opacity: '0' |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
138 |
}, |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
139 |
{ |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
140 |
duration: options.fadeOutSpeed, |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
141 |
complete: function () |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
142 |
{ |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
143 |
notice.animate( |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
144 |
{ |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
145 |
height: '0px' |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
146 |
}, |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
147 |
{ |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
148 |
duration: options.fadeOutSpeed, |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
149 |
complete: function () |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
150 |
{ |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
151 |
notice.remove(); |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
152 |
} |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
153 |
} |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
154 |
); |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
155 |
} |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
156 |
} |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
157 |
); |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
158 |
} |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
159 |
}; |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
160 |
}; |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
161 |
|
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
162 |
$.fn.purr = function ( options ) |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
163 |
{ |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
164 |
options = options || {}; |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
165 |
options.fadeInSpeed = options.fadeInSpeed || 500; |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
166 |
options.fadeOutSpeed = options.fadeOutSpeed || 500; |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
167 |
options.removeTimer = options.removeTimer || 4000; |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
168 |
options.isSticky = options.isSticky || false; |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
169 |
options.usingTransparentPNG = options.usingTransparentPNG || false; |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
170 |
|
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
171 |
this.each( function() |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
172 |
{ |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
173 |
new $.purr( this, options ); |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
174 |
} |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
175 |
); |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
176 |
|
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
177 |
return this; |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
178 |
}; |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
179 |
})( jQuery ); |
91cf6872d853
Add jqeury purr plugin for help text.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
180 |