Skip to content

Instantly share code, notes, and snippets.

@fupslot
Created March 25, 2014 09:53
Show Gist options
  • Save fupslot/9758345 to your computer and use it in GitHub Desktop.
Save fupslot/9758345 to your computer and use it in GitHub Desktop.
;(function($, window, document, undefined) {
'use strict';
var pluginName = 'FunnelViz'
, defaults = {
};
function init () {
}
function Plugin (el, options) {
// Save the element reference, both as a jQuery
// reference and a normal reference
this.el = el;
this.$el = $(el);
this.options = options;
this._defaults = defaults;
this._name = pluginName;
this.init();
}
Plugin.prototype = {
init: function () {
},
};
$.fn[pluginName] = function (method) {
var args = arguments;
return this.each(function () {
var $this = $(this)
, data = $this.data('plugin_'+pluginName)
, options = $.extend({}, defaults, $.isPlainObject(method) && method);
if (!data) $this.data('plugin_'+pluginName, (data = new Plugin(this, options)));
if (typeof method == 'string') data[method].apply(data, Array.prototype.slice.call(args, 1));
});
};
})(jQuery, window, document);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment