JQuery自定义用户控件方法汇总


首先必用 JQuery.fn.extend方法 

使用方法:

jQuery.fn.extend({});
其次 相应控件配置参数设置:

jQuery.fn.extend({
    uploadPreview: function (opts) {
        opts = jQuery.extend({
            Img: "ImgPr",
            Width: 100,
            Height: 100,
            ImgType: ["gif", "jpeg", "jpg", "bmp", "png"],
            Callback: function () { }
        }, opts || {});
});
设置控件方法:

var _self = this;
var _this = $(this);
_this.change(function () {});


控件赋予事件:

 $("#id").uploadPreview({ Img: "ImgPr", Width: 120, Height: 120, ImgType: ["gif", "jpeg", "jpg", "bmp", "png"], Callback: function () { }}); 
原文地址:https://www.cnblogs.com/xyzhuzhou/p/3455090.html