Skip to content

Instantly share code, notes, and snippets.

@alfg
Created December 31, 2014 18:48
Show Gist options
  • Save alfg/273af355d505cf9a57eb to your computer and use it in GitHub Desktop.
Save alfg/273af355d505cf9a57eb to your computer and use it in GitHub Desktop.
Basic constructor pattern with jQuery support
;(function($) {
// Plugin constructor with options and methods
var MainPlugin = function() {
var _self = this;
var _options = {
foo: "bar"
};
this.methods = {
init: function () {
// Loads foundation jquery plugins
$(document).foundation();
// Load slick carousel plugin
$('.banners').slick({
dots: true
});
},
}
// Initialize
_self.methods.init();
};
// Load plugin on document ready
$(document).ready(new MainPlugin());
})($);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment