Created
November 1, 2010 23:08
-
-
Save lukemorton/659030 to your computer and use it in GitHub Desktop.
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
/** | |
* 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