Revision: 33154
Updated Code
at April 21, 2011 06:15 by gdpotter
Updated Code
(function( $ ){
// Default options
var defaults = {
// OPTIONS
// ...
};
var methods = {
init : function( options ) {
// Merge defaults with user options
options = $.extend({}, defaults, options);
// Return jQuery object to maintain chainability
return this.each(function() {
var $this = $(this);
});
},
method2 : function( ) {
// Return jQuery object to maintain chainability
return this.each(function() {
var $this = $(this);
});
},
method3 : function( ) {
// Return jQuery object to maintain chainability
return this.each(function() {
var $this = $(this);
});
},
method4 : function( options ) {
// Merge defaults with user options
var options = $.extend(defaults, options);
// Return jQuery object to maintain chainability
return this.each(function() {
var $this = $(this);
});
}
};
$.fn.PLUGINNAME= function( method ) {
// Method calling logic
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' );
}
};
})( jQuery );
Revision: 33153
Updated Code
at October 6, 2010 14:41 by gdpotter
Updated Code
(function( $ ){
// Default options
var defaults = {
// OPTIONS
// ...
};
var methods = {
init : function( options ) {
// Merge defaults with user options
var options = $.extend(defaults, options);
// Return jQuery object to maintain chainability
return this.each(function() {
var $this = $(this);
});
},
method2 : function( ) {
// Return jQuery object to maintain chainability
return this.each(function() {
var $this = $(this);
});
},
method3 : function( ) {
// Return jQuery object to maintain chainability
return this.each(function() {
var $this = $(this);
});
},
method4 : function( options ) {
// Merge defaults with user options
var options = $.extend(defaults, options);
// Return jQuery object to maintain chainability
return this.each(function() {
var $this = $(this);
});
}
};
$.fn.PLUGINNAME= function( method ) {
// Method calling logic
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' );
}
};
})( jQuery );
Revision: 33152
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at October 6, 2010 14:39 by gdpotter
Initial Code
(function( $ ){
// Default options
var defaults = {
// OPTIONS
// ...
};
var methods = {
init : function( options ) {
// Merge defaults with user options
var options = $.extend(defaults, options);
// Return jQuery object to maintain chainability
return this.each(function() {
var $this = $(this);
});
},
method2 : function( ) {
// Return jQuery object to maintain chainability
return this.each(function() {
var $this = $(this);
});
},
method3 : function( ) {
// Return jQuery object to maintain chainability
return this.each(function() {
var $this = $(this);
});
},
method4 : function( options ) {
console.log("update Function called");
}
};
$.fn.PLUGINNAME= function( method ) {
// Method calling logic
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' );
}
};
})( jQuery );
Initial URL
Initial Description
Initial Title
jQuery Plugin Structure
Initial Tags
plugin, jquery
Initial Language
jQuery