Skip to content

Instantly share code, notes, and snippets.

@joecritch
Created April 19, 2011 19:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joecritch/929295 to your computer and use it in GitHub Desktop.
Save joecritch/929295 to your computer and use it in GitHub Desktop.
Part 4 - Wrapper
// '$.fn' is jQuery's prototype. Practically all plugins work this way. It's just that we're not really doing much directly inside of it.
$.fn.simpleScroll = function(conf) {
// If the plugin was to be matched by several elements, this part of the plugin would only run once. But see how we then loop through "this"...?
// (This merges the default options that we namespaced at the beginning, with any new options being passed in by the user)
var conf = $.extend({}, $.motionlab.simpleScroll.conf, conf);
// Okay, now we loop through ALL the matched elements.
return this.each(function() {
// Create a new carousel per matched element.
el = new SimpleScroll($(this), conf);
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment