我现在有一个函数 $.fn.AutosizeImage = function(options){
var defaults={
width:0,
height:0
};
var options = $.extend(defaults, options);
this.each(function(){
var height= options.height;
var width= options.width;
resizeImg($(this),width,height,options.priority);//这里要判断
});
};
在resizeImg方法中要判断触发方法,如果事件是直接加载触发的,就需要这样写:$(this).load(function(){
resizeImg($(this),width,height,options.priority);
}如果是由 Click事件触发就直接: resizeImg($(this),width,height,options.priority);
那么我如何判断呢?
var defaults={
width:0,
height:0
};
var options = $.extend(defaults, options);
this.each(function(){
var height= options.height;
var width= options.width;
resizeImg($(this),width,height,options.priority);//这里要判断
});
};
在resizeImg方法中要判断触发方法,如果事件是直接加载触发的,就需要这样写:$(this).load(function(){
resizeImg($(this),width,height,options.priority);
}如果是由 Click事件触发就直接: resizeImg($(this),width,height,options.priority);
那么我如何判断呢?
width:0,
height:0,
eventType: 'click' //load
}