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()

 

posted @ 2013-07-08 01:14  -恩恩-  阅读(156)  评论(0编辑  收藏  举报