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($){
- //Attach this new method to jQuery
- $.fn.extend({
- //This is where you write your plugin's name:
- //Simple jQuery Notification
- sjn: function(options) {
- //construktor
- var defaults ={
- 'fadeInTime':1000,
- 'fadeOutTime':1000,
- 'maxOpacity':0.85
- }
- var options = $.extend(defaults, options);
- //Public Functions
- this.show = function(){
- console.log(options.fadeInTime);
- //var obj = $(this);
- /* $(this).animate(
- {
- opacity: options.maxOpacity
- },
- options.fadeInTime,
- function(){
- console.log("FadinIn Complete...");
- }
- );*/
- }
- this.hide = function(){
- $(this).animate(
- {
- opacity: 0
- },
- options.fadeOutTime,
- 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