Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- *This is my first jQuery PlugIn and it is based on the following tutorial:
- *http://www.queness.com/post/112/a-really-simple-jquery-plugin-tutorial
- *
- */
- //You need an anonymous function to wrap around your function to avoid conflict
- (function($){
- var self = this;
- //Attach this new method to jQuery
- $.fn.extend({
- //This is where you write your plugin's name:
- //Simple jQuery Notification
- sjn: function() {
- //public properties with defaults
- this.fadeInTime = 1000;
- this.fadeOutTime = 1000;
- this.maxOpacity = 0.85;
- //construktor
- /*var defaults ={
- 'fadeInTime':1000,
- 'fadeOutTime':1000,
- 'maxOpacity':0.85
- }*/
- /*var options = $.extend(defaults, options);*/
- //Public Functions
- this.show = function(message){
- //console.log(self.fadeInTime);
- //var obj = $(this);
- console.log(message);
- $(this).stop();
- $(this).animate(
- {
- opacity: this.maxOpacity
- },
- this.fadeInTime, 'easeOutQuart',
- function(){
- hide();
- }
- );
- }
- //private Functions
- function hide(){
- $(this).stop();
- $(this).animate(
- {
- opacity: 0
- },
- this.fadeOutTime, 'easeOutQuart',
- function(){
- console.log("FadinOut Complete...");
- }
- );
- }
- return this;
- }
- }
- );
- //pass jQuery to the function,
- //So that we will able to use any valid Javascript variable name
- //to replace "$" SIGN. But, we'll stick to $ (I like dollar sign: ) )
- })(jQuery);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement