Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
21627 kshitij.so 1
var Gritter = function () {
2
 
3
    $('#add-sticky').click(function(){
4
 
5
        var unique_id = $.gritter.add({
6
            // (string | mandatory) the heading of the notification
7
            title: 'This is a sticky notice!',
8
            // (string | mandatory) the text inside the notification
9
            text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus eget tincidunt velit. Cum sociis natoque penatibus et <a href="#" style="color:#ccc">magnis dis parturient</a> montes, nascetur ridiculus mus.',
10
            // (string | optional) the image to display on the left
11
            image: 'img/avatar-mini.jpg',
12
            // (bool | optional) if you want it to fade out on its own or just sit there
13
            sticky: true,
14
            // (int | optional) the time you want it to be alive for before fading out
15
            time: '',
16
            // (string | optional) the class name you want to apply to that specific message
17
            class_name: 'my-sticky-class'
18
        });
19
 
20
        // You can have it return a unique id, this can be used to manually remove it later using
21
        /*
22
         setTimeout(function(){
23
 
24
         $.gritter.remove(unique_id, {
25
         fade: true,
26
         speed: 'slow'
27
         });
28
 
29
         }, 6000)
30
         */
31
 
32
        return false;
33
 
34
    });
35
 
36
    $('#add-regular').click(function(){
37
 
38
        $.gritter.add({
39
            // (string | mandatory) the heading of the notification
40
            title: 'This is a regular notice!',
41
            // (string | mandatory) the text inside the notification
42
            text: 'This will fade out after a certain amount of time. Vivamus eget tincidunt velit. Cum sociis natoque penatibus et <a href="#" style="color:#ccc">magnis dis parturient</a> montes, nascetur ridiculus mus.',
43
            // (string | optional) the image to display on the left
44
            image: 'img/avatar-mini.jpg',
45
            // (bool | optional) if you want it to fade out on its own or just sit there
46
            sticky: false,
47
            // (int | optional) the time you want it to be alive for before fading out
48
            time: ''
49
        });
50
 
51
        return false;
52
 
53
    });
54
 
55
    $('#add-max').click(function(){
56
 
57
        $.gritter.add({
58
            // (string | mandatory) the heading of the notification
59
            title: 'This is a notice with a max of 3 on screen at one time!',
60
            // (string | mandatory) the text inside the notification
61
            text: 'This will fade out after a certain amount of time. Vivamus eget tincidunt velit. Cum sociis natoque penatibus et <a href="#" style="color:#ccc">magnis dis parturient</a> montes, nascetur ridiculus mus.',
62
            // (string | optional) the image to display on the left
63
            image: 'img/avatar-mini.jpg',
64
            // (bool | optional) if you want it to fade out on its own or just sit there
65
            sticky: false,
66
            // (function) before the gritter notice is opened
67
            before_open: function(){
68
                if($('.gritter-item-wrapper').length == 3)
69
                {
70
                    // Returning false prevents a new gritter from opening
71
                    return false;
72
                }
73
            }
74
        });
75
 
76
        return false;
77
 
78
    });
79
 
80
    $('#add-without-image').click(function(){
81
 
82
        $.gritter.add({
83
            // (string | mandatory) the heading of the notification
84
            title: 'This is a notice without an image!',
85
            // (string | mandatory) the text inside the notification
86
            text: 'This will fade out after a certain amount of time. Vivamus eget tincidunt velit. Cum sociis natoque penatibus et <a href="#" style="color:#ccc">magnis dis parturient</a> montes, nascetur ridiculus mus.'
87
        });
88
 
89
        return false;
90
    });
91
 
92
    $('#add-gritter-light').click(function(){
93
 
94
        $.gritter.add({
95
            // (string | mandatory) the heading of the notification
96
            title: 'This is a light notification',
97
            // (string | mandatory) the text inside the notification
98
            text: 'Just add a "gritter-light" class_name to your $.gritter.add or globally to $.gritter.options.class_name',
99
            class_name: 'gritter-light'
100
        });
101
 
102
        return false;
103
    });
104
 
105
    $("#remove-all").click(function(){
106
 
107
        $.gritter.removeAll();
108
        return false;
109
 
110
    });
111
 
112
 
113
 
114
}();