View difference between Paste ID: dzSuSV5q and s15WmBnr
SHOW: | | - or go back to the newest paste.
1
/*
2
 *This is my first jQuery PlugIn and it is based on the following tutorial:
3
 *http://www.queness.com/post/112/a-really-simple-jquery-plugin-tutorial
4
 *
5
 */
6
7
//You need an anonymous function to wrap around your function to avoid conflict
8
(function($){
9
 
10
    var self = this;
11
    
12
    //Attach this new method to jQuery
13
    $.fn.extend({
14
         
15-
        sjn: function(options) {
15+
16
        //Simple jQuery Notification
17
        sjn: function() {
18-
            var defaults ={
18+
             
19
             
20
            //public properties with defaults
21
            this.fadeInTime = 1000;
22
            this.fadeOutTime = 1000;
23-
            var options = $.extend(defaults, options);
23+
            this.maxOpacity = 0.85;
24
            
25
           
26
            //construktor
27-
            this.show = function(){
27+
            /*var defaults ={
28-
                console.log(options.fadeInTime);
28+
29
                'fadeOutTime':1000,
30-
               /* $(this).animate(
30+
31-
                {
31+
            }*/
32-
                    opacity: options.maxOpacity
32+
            /*var options = $.extend(defaults, options);*/
33-
                }, 
33+
34-
                    options.fadeInTime, 
34+
35
            //Public Functions
36-
                        console.log("FadinIn Complete...");
36+
            this.show = function(message){
37
                //console.log(self.fadeInTime);
38-
                );*/
38+
39
                console.log(message);
40
                $(this).stop();
41-
            this.hide = function(){
41+
42
                    {
43
                        opacity: this.maxOpacity
44
                    }, 
45
                    this.fadeInTime, 'easeOutQuart',
46-
                    options.fadeOutTime, 
46+
47
                           hide();
48
                    }
49
                );
50
            }
51
52
            //private Functions
53
            function hide(){
54-
                
54+
                $(this).stop();
55
                $(this).animate(
56
                    {
57
                        opacity: 0
58
                    }, 
59
                    this.fadeOutTime, 'easeOutQuart',
60-
     
60+
61
                        console.log("FadinOut Complete...");
62
                    }
63
                );
64
            } 
65
                   
66
            return this;
67
        }
68
        
69
    }
70
    
71
   
72
);
73
  
74
   
75
//pass jQuery to the function,
76
//So that we will able to use any valid Javascript variable name
77
//to replace "$" SIGN. But, we'll stick to $ (I like dollar sign: ) )      
78
})(jQuery);