Created
December 16, 2013 07:28
-
-
Save mediaash/7983499 to your computer and use it in GitHub Desktop.
jQuery template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* required jQuery | |
*/ | |
;(function($){ | |
/* jQuery plugin template */ | |
var plugname = "your_plugin_name"; | |
$.fn[plugname] = function(method) { | |
if ( methods[method] ) { | |
return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 )); | |
} else if ( typeof method === 'object' || ! method ) { | |
return methods.init.apply( this, arguments ); | |
} else { | |
$.error( 'Method ' + method + ' does not exist on jQuery.' + plugname ); | |
return this; | |
} | |
}; | |
var methods = {}; | |
/* override */ | |
methods.init = function(config) { | |
return this.each(function(i) { | |
var defaults = { | |
}; | |
var options = $.extend(true, defaults, config); | |
}); | |
} | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment