的jsfiddle的方法:http://jsfiddle.net/bg9vL/
控制檯輸出:試圖寫一個jQuery插件,但我不知道該怎麼稱呼由init
Uncaught TypeError: Object [object global] has no method 'each'
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();
});
}, ...
回調是的!它在js部分。 – rtheunissen
哎呀,對不起。但是我沒有收到你指定的錯誤。在imgur圖像上獲得403。 – Dogbert
這很奇怪......這是一個很好的鏈接。 – rtheunissen