6
6
< link type ="text/css " rel ="stylesheet " href ="http://www.erichynds.com/examples/style.css " />
7
7
< link type ="text/css " rel ="stylesheet " href ="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/redmond/jquery-ui.css " />
8
8
< link type ="text/css " rel ="stylesheet " href ="ui.notify.css " />
9
+ < style type ="text/css "> form input { display : block; width : 250px ; margin-bottom : 5px }</ style >
9
10
< script src ="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js " type ="text/javascript "> </ script >
10
11
< script src ="http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.js " type ="text/javascript "> </ script >
11
- < script src ="http://jqueryui.com/themeroller/themeswitchertool/ " type ="text/javascript "> </ script >
12
12
< script src ="src/jquery.notify.js " type ="text/javascript "> </ script >
13
13
< script type ="text/javascript ">
14
- $ ( function ( ) {
14
+ // create a test notification
15
+ function basic ( ) {
16
+ $container . notify ( "create" , {
17
+ title : 'Default Notification' ,
18
+ text : 'This is an example of the default config. I will disappear up after five seconds.'
19
+ } ) ;
20
+ }
21
+
22
+ function sticky ( ) {
23
+ $container . notify ( "create" , {
24
+ title : 'Sticky Notification' ,
25
+ text : 'This is an example of a "sticky" notification. The only way to close me is to click on the X above.'
26
+ } , { expires :false } ) ;
27
+ }
28
+
29
+ function warning ( ) {
30
+ $container . notify ( "create" , {
31
+ title : 'Warning!' ,
32
+ text : 'OMG the quick brown fox jumped over the lazy dog. You\'ve been warned. <a href="#" class="ui-notify-close">Close me.</a>' ,
33
+ icon : '<img src="alert.png" style="margin:0 10px 0 0" />'
34
+ } , { expires :false } ) ;
35
+ }
36
+
37
+ function clickable ( ) {
38
+ $container . notify ( "create" , {
39
+ title : 'Clickable Notification' ,
40
+ text : 'Click on me to fire a callback. Do it quick though because I will fade out after 5 seconds.'
41
+ } , {
42
+ click : function ( e , instance ) {
43
+ alert ( "Click triggered!\n\nTwo options are passed into the click callback: the original event obj and the instance object." ) ;
44
+ }
45
+ } ) ;
46
+ }
15
47
48
+ $ ( function ( ) {
16
49
// initialize widget on a container, passing in all the defaults.
17
50
// the defaults will apply to any notification created within this
18
51
// container, but can be overwritten on notification-by-notification
19
52
// basis.
20
53
$container = $ ( "#container" ) . notify ( ) ;
21
54
22
- // create a test notification
23
- $container . notify ( "create" , {
24
- title : 'Test Notification' ,
25
- text : 'This is an example of the default config, and will slide up after five seconds.'
26
- } ) ;
27
-
28
- // create another, and save the obj into the var instance.
29
- instance = $container . notify ( "create" , {
30
- title : 'Sticky Notification' ,
31
- text : 'This is an example of a "sticky" notification. The only way to close me is to click on the X above.'
32
- } , {
33
- expires :false
34
- } ) ;
55
+ // create two when the pg loads
56
+ basic ( ) ;
57
+ sticky ( ) ;
35
58
36
- // since the above instance is "sticky", it can be manually closed by calling instance.close();
59
+ // bindings
60
+ $ ( "#default" ) . click ( basic ) ;
61
+ $ ( "#sticky" ) . click ( sticky ) ;
62
+ $ ( "#warning" ) . click ( warning ) ;
63
+ $ ( "#clickable" ) . click ( clickable ) ;
37
64
} ) ;
38
65
</ script >
39
66
@@ -46,10 +73,18 @@ <h1>jQuery UI Notify Widget</h1>
46
73
< p > This is a growl/ubuntu-like notification system built on top of jQuery UI.</ p >
47
74
< p > Download & docs @ < a href ="http://github.com/ehynds/jquery-notify "> http://github.com/ehynds/jquery-notify</ a > .</ p >
48
75
76
+ < form style ="margin:20px 0 ">
77
+ < input type ="button " id ="default " value ="Open with default configuration " />
78
+ < input type ="button " id ="sticky " value ="Create a "sticky" notification " />
79
+ < input type ="button " id ="warning " value ="A more custom template " />
80
+ < input type ="button " id ="clickable " value ="The entire notification can be clicked on " />
81
+ </ form >
82
+
49
83
<!--- container to hold notifications --->
50
84
< div id ="container ">
51
85
< div >
52
- < a class ="ui-notify-close " href ="# "> x</ a >
86
+ < div class ="icon " style ="float:left "> #{icon}</ div >
87
+ < a class ="ui-notify-close ui-notify-cross " href ="# "> x</ a >
53
88
< h1 > #{title}</ h1 >
54
89
< p > #{text}</ p >
55
90
</ div >
0 commit comments