Last active
December 15, 2015 15:09
-
-
Save j0lvera/5279832 to your computer and use it in GitHub Desktop.
jQuery plugin boilerplate
This file contains hidden or 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
;(function($, window, document) { | |
$.fn.pluginName = function(options) { | |
// defaults | |
var d = $.extend({ | |
default: 1 | |
}, options); | |
// settings or bindUI | |
var s = { | |
el1 : $('.el1'), | |
el2 : $('.el2'); | |
}; | |
// plugin logic | |
var init = function() { | |
// all the cool stuff your plugin gonna do | |
s.el1.addClass('someCSS'); | |
// to use a default option use d.default | |
someHelper(d.default); | |
}; | |
// helper functions | |
function someHelper() { | |
} | |
// do it | |
init(); | |
}; | |
})(jQuery, window, document); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment