Skip to content

Instantly share code, notes, and snippets.

@antoviaque
Created December 12, 2013 14:59
Show Gist options
  • Select an option

  • Save antoviaque/7929345 to your computer and use it in GitHub Desktop.

Select an option

Save antoviaque/7929345 to your computer and use it in GitHub Desktop.
(function($) {
$.scribble = {
window: window,
location: location,
bootstrap: function(root) {
var $this = this;
if(root.hasClass('scribble_root')) {
console.log('Error: Scribble is already instanciated on this/these DOM element(s)');
} else {
$this.render(root);
}
},
render: function(root) {
root.empty();
root.addClass('scribble_root');
root.append('<a href="#">Scribble!</a>');
}
};
$.fn.scribble = function() {
console.log(this);
return this.each(function() {
$.scribble.bootstrap($(this));
});
};
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment