jquery插件开发模版

;(function($){

    $.fn.fly = function(options){
        var opts = $.extend({},$.fn.fly.defaults,options);
        var $obj = $(this);
        var Fly = function(){
            this.init.apply(this,arguments);
        };
        Fly.prototype = {
            init : function(){
                console.log(opts.name+opts.style);
            }
        }

        new Fly();
        return $obj; 
    };
    $.fn.fly.defaults = {
        name : "enen",
        style :" 要飞起来哇!!!!!gogogo"
    }
})(jQuery);
$("body").fly()
原文地址:https://www.cnblogs.com/enen/p/3177060.html