Skip to content

Instantly share code, notes, and snippets.

@mostlyfine
Created December 6, 2011 08:17
Show Gist options
  • Select an option

  • Save mostlyfine/1437338 to your computer and use it in GitHub Desktop.

Select an option

Save mostlyfine/1437338 to your computer and use it in GitHub Desktop.
プラグインの単体呼び出し、オプションの指定
//
// プラグイン呼び出し
//
$(function() {
$.sample({debug:true});
});
//
// プラグイン本体
//
(function($) {
var name_space = "sample";
$[name_space] = function(options) {
var debug = function(msg) {
if(options.debug && window.console && window.console.log) {
window.console.log(msg);
}
};
options = $.extend({
debug: false
}, options);
debug("this is debug massage");
return this;
};
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment