(function($) {

    // 플러그명
    $.pluginName = function(element, options) {

        // 옵션
        var defaults = {

            foo: 'bar',

            onFoo: function() {}

        }

        var plugin = this;
        // 플러그인 셋팅
        plugin.settings = {}

        var $element = $(element), 
             element = element;    

    
        plugin.init = function() {

            plugin.settings = $.extend({}, defaults, options);

        }

        plugin.foo_public_method = function() {

            // 코드 입력

        }

     
        var foo_private_method = function() {

            // 코드 입력

        }


        plugin.init();

    }

    // add the plugin to the jQuery.fn object
    $.fn.pluginName = function(options) {

        // iterate through the DOM elements we are attaching the plugin to
        return this.each(function() {

            // if plugin has not already been attached to the element
            if (undefined == $(this).data('pluginName')) {

                // create a new instance of the plugin
                // pass the DOM element and the user-provided options as arguments
                var plugin = new $.pluginName(this, options);

                // in the jQuery version of the element
                // store a reference to the plugin object
                // you can later access the plugin and its methods and properties like
                // element.data('pluginName').publicMethod(arg1, arg2, ... argn) or
                // element.data('pluginName').settings.propertyName
                $(this).data('pluginName', plugin);

            }

        });

    }

})(jQuery);