Skip to content

Instantly share code, notes, and snippets.

@bergantine
Last active October 2, 2015 20:18
Show Gist options
  • Save bergantine/2312446 to your computer and use it in GitHub Desktop.
Save bergantine/2312446 to your computer and use it in GitHub Desktop.
jQuery plugin template. #jquery #plugin #javascript
// based on http://blog.jeremymartin.name/2008/02/building-your-first-jquery-plugin-that.html
(function($){
$.fn.PLUGIN-NAME = function(options) {
var defaults = {
VARIABLE: PARAMETER,
VARIABLE2: PARAMETER
// i.e. minTrail: 20
};
var options = $.extend(defaults, options);
return this.each(function() {
// guts go here
});
};
})(jQuery);
// TO CALL
<script type="text/javascript">
$().ready(function() {
$('ELEMENT-TO-AFFECT').PLUGIN-NAME();
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment