不同的extend 在调用构造函数时不同的写法

时间:2021-08-19 09:09:56
 /**
 * jQuery.hhNewSilder 滚动图片插件
 * User: huanhuan
 * QQ: 651471385
 * Email: th.wanghuan@gmail.com
 * 微博: huanhuan的天使
 * Date: 13-10-11
 * Time: 下午1:20
 * Dependence jquery-1.7.2.min.js
 */
function silder(infor){
    //第1种调用方法
    var defaults = {
       imgBox : function(){return new Getimg();}
    }
    var option = $.extend(defaults, infor);
    function Getimg(){
        this.imgList = $('.box');
    }
    option.imgBox().imgList;
    //第2种调用方法
    var op = $.extend({
        picBox:new GetImg()
    },infor);
    function GetImg(){
        this.cir = $('.box');
    }
    op.picBox.cir;
    //调用方法
    function GetSize(){
        this.w = $('.'+option.picBox,_thisAll).width();
        this.h = $('.'+option.picBox,_thisAll).height();
        return this;
    }
    var s = GetSize;
    s.w
    //调用方法
    function getSiz(){
        var w = $('.'+option.picBox,_thisAll).width();
        var h = $('.'+option.picBox,_thisAll).height();
        return { w: w, h: h}
    }
    var size = getSiz();
    size.w 
}

相关文章