Revision: 45049
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at April 22, 2011 22:16 by mike_fowler
Initial Code
( function( $ ) {
// Global variables
var i, j;
// Default settings
var settings = {
"property" : 'value'
};
// Methods
var methods = {
init: function(options) {
// Capture $(this) global as a local variable
var $this = $(this);
// Extend settings with provided options
if( options ) {
$.extend(settings, options);
}
// Example method call
$this.pluginName('methodTwo');
$this.pluginName('methodThree');
},
methodTwo: function() {
},
methodThree: function() {
}
};
// Plugin namespace initialization
$.fn.pluginName = function(methd) {
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.pluginName' );
}
}
// Standalone functions
function doThis(property) {
return 1;
}
} (jQuery) );
Initial URL
Initial Description
Initial Title
jQuery Plugin Template
Initial Tags
template, jquery
Initial Language
jQuery