Skip to content

Instantly share code, notes, and snippets.

@lukemorton
Created November 1, 2010 23:08
Show Gist options
  • Save lukemorton/659030 to your computer and use it in GitHub Desktop.
Save lukemorton/659030 to your computer and use it in GitHub Desktop.
/**
* Localise window element and a semi-colon to fix any missing
* line endings in previous code.
*/
;(function (window, undefined) {
/**
* Local scope document and $
*/
var document = window.document;
var $ = window.jQuery;
/**
* A jQuery Namespace for public interface
*/
$.pluginName = {};
/**
* Public Static Settings
*/
$.pluginName.globalSettings = {
// Settings can be anything from a string
"setting" : "value",
// To a callback
"another" : function () {}
};
/**
* Public Init Method
*/
$.pluginName.init = function (el, settings) {
// jQuery object reference
var $el = $(el);
// Merge settings
settings = $.extend({}, $.pluginName.globalSettings, settings);
};
/**
* jQuery Selector Method
*/
$.fn.pluginName = function (settings) {
// For each element
return this.each(function () {
// Initialise elements individually
$.pluginName.init(this, settings);
});
};
}(this));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment