LoginSignup
22
22

More than 5 years have passed since last update.

CoffeeScriptで作るjQueryプラグイン

Posted at

たぶん動く。

do (jQuery) ->
  $ = jQuery
  $.fn.mypluin = (config) ->
    defaultConfig =
      color: 'red'
    options = $.extend(defaultConfig, config);
    @each () ->
      $(@).css('color', options.red)
(function(jQuery) {
  var $;
  $ = jQuery;
  return $.fn.mypluin = function(config) {
    var defaultConfig, options;
    defaultConfig = {
      color: 'red'
    };
    options = $.extend(defaultConfig, config);
    return this.each(function() {
      return $(this).css('color', options.red);
    });
  };
})(jQuery);
22
22
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
22
22