/ Published in: jQuery
                    
                                        
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
;(function($) {
$.pluginName = function(el, options) {
var defaults = {
propertyName: 'value',
onSomeEvent: function() {}
},
plugin = this;
plugin.settings = {};
var init = function() {
plugin.settings = $.extend({}, defaults, options);
plugin.el = el;
plugin.$el = $(el);
// code goes here
};
plugin.fooPublicMethod = function() {
// code goes here
};
var fooPrivateMethod = function() {
// code goes here
};
init();
}
})(jQuery);
// Uages
$(document).ready(function() {
// create a new instance of the plugin
var myplugin = new $.pluginName($('#element'), {option: "value"});
// call a public method
myplugin.fooPublicMethod();
// get the value of a public property
myplugin.settings.property;
});
URL: http://jqueryboilerplate.com/
Comments
 Subscribe to comments
                    Subscribe to comments
                
                