Skip to content

Instantly share code, notes, and snippets.

@winton
Created May 11, 2009 20:31
Show Gist options
  • Select an option

  • Save winton/110164 to your computer and use it in GitHub Desktop.

Select an option

Save winton/110164 to your computer and use it in GitHub Desktop.
(function($) {
$.rotator = function(element_or_selector, options) {
$(element_or_selector).plugin(options);
};
$.rotator.defaults = {
// default options
};
$.fn.rotator = function(options) {
// define vars here
// Public methods
$.fn.extend({
});
// Constructor
return this.each(function() {
initialize($(this));
});
// Private methods
function initialize(el) {
setOptions(el);
// assign vars here
}
function setOptions(el) {
if (options)
options = $.extend({}, $.rotator.defaults, options);
else if (!(options = el.data('rotator_options')))
options = $.rotator.defaults;
el.data('rotator_options', options);
}
};
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment