jsFiddle:http: //jsfiddle.net/bg9vL/
控制台输出:
未捕获的类型错误:对象 [对象全局] 没有方法“每个”
var methods = {
init: function (options) {
// Create some defaults, extending them with any options that were provided
var settings = $.extend({
'maxWidth': 0,
'maxHeight': 0,
'forceAspect': true
}, options);
return this.each(function () {
// if max size wasn't specified, position only
var nosize = settings.maxWidth === 0 || settings.maxHeight === 0;
var container = $(this).parent();
$(this).css('position', 'relative');
// fit when window is resized
$(window).bind('resize.tailorfit', methods.fit);
// fit when page has loaded
$(window).bind('load.tailorfit', methods.fit);
// fit on initial load
methods.fit.apply();
});
}, ...