나는 보통 이런 종류의 것을 게시하지 않는다. 그러나 나는 완전히 아이디어에서 벗어났다. 그리고이 것을 고치려고 노력한 후에 나는 어디서 오류를 찾을 지 모르고이 오류가 무엇을 의미하는지조차 모른다.jQuery : "A undefined"오류가 발생하고 JSLint에서 "jQuery (...)가 잘못 호출되었습니다."여기에 무엇이 잘못 되었습니까?
나누기 페이지는 여기에서 볼 수 있습니다 : http://staging.mathewhawley.com/
나는이 오류가 발생할 것으로 보인다 조금 columnizer
jQuery 플러그인을 구축해야하지만, 나에게 내가 플러그인에서 작성한 모든 모양이 완벽하게 유효합니다.
다음이 기록되고있는 방화범 console
및 JSLint
켜기 :
jQuery(...) called incorrectly
jquery.lint.js (line 96)
More info:
jquery.lint.js (line 111)
jQuery(...) called incorrectly
jquery.lint.js (line 96)
More info:
jquery.lint.js (line 111)
a is undefined
[Break On This Error] (function(a,b){function cg(a){return d...a:a+"px")}}),a.jQuery=a.$=d})(window);
jquery.min.js (line 16)
클릭을 나는 다음 얻을 '추가 정보'링크 :
Location:
jquery.lint.js (line 111)
You passed: ["#projects", undefined, jQuery(Document index.php)]
Available signatures include:
jQuery(selector, [context])
jQuery(element)
jQuery(elementArray)
jQuery(jQuery object)
jQuery()
jQuery(html, [ownerDocument])
jQuery(html, props)
jQuery(callback)
나는 최신을 사용하고 있습니다를 구글 CDN (<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
)을 통해 jQuery 버전.
script.js // this file invokes all javascript.
jQuery(document).ready(function($) {
// helper
function scrollable() {
if ($.browser.webkit) {
return $('body');
} else {
return $('html');
}
}
// =========================
// = Stuff on the homepage =
// =========================
if ($('#projects').length) {
$('#projects').children().hide();
// Create column layout
$(window).load(function() {
$('#projects').columnize();
function _reveal(el) {
if (el !== undefined) {
el.fadeIn(100 , function() { _reveal($(this).next()); });
}
}
_reveal($('#projects').children().first());
});
}
// =============================
// = Stuff on the project page =
// =============================
// Add sticky project info
if ($('#project').length) {
$('article','#project').sticky();
// Back to Top link
$('nav a[href=#tothetop]').click(function(e) {
e.preventDefault();
scrollable().animate({'scrollTop':0}, 400);
});
}
});
:
또한 여기, 외부 페이지를보고 좋아하지 않는 사람들을 위해 일을 깰 것으로 보인다 내 columnizer 스크립트입니다.
jquery.columnizer.js // the columnizer helper script
(function($){
$.fn.extend({
columnize: function(options) {
var defaults = {
columns : 3,
gutter : 20
},
options = $.extend(defaults, options),
o = options,
internal = {},
_i = internal;
_i.container = $(this); // container
_i.containerHeight = 0; // container
_i.items = _i.container.children(); // elements inside container
_i.w = _i.items.first().width();
_i.columns = {};
_i.colHeight = {};
// Setup the container and its children's position
_i.container.css({
'position': 'relative'
}).children().css({
'position': 'absolute'
});
// cycle through all items and place them into arrays by column
_i.items.each(function(i) {
var itemPlace = i%o.columns; // get the column
var col = itemPlace + 1; // start index at 1
if (_i.columns[col] === undefined) {
_i.columns[col] = [$(this)]; // if the column doesn't already exist create it
} else {
_i.columns[col].push($(this)); // otherwise add the current element to the correct column
}
var left = itemPlace * (_i.w + o.gutter); // calculate the left offset for the columns
$(this).css({
'left': left + 'px', // apply the offset
'margin-left': 0 // and make sure no margin-left is on the container
});
});
// Cycle through the existing columns
for (var x=1; x <= o.columns; x++) {
if (_i.colHeight[x] === undefined) { // create variables for storing the top offset to be applied to elements of this column
_i.colHeight[x] = 0; // start at creating it and setting it to 0
}
$.each(_i.columns[x], function(z, el) { // within each column cycle through its items
$el = $(el);
$el.css('top', _i.colHeight[x]+'px'); // set the top offset
_i.colHeight[x] += $el.outerHeight(true); // then add this elements height to the same variable
});
};
// go through the columns
$.each(_i.colHeight, function(key, val) {
if (_i.containerHeight < val) {
_i.containerHeight = val; // if this column's height is greater than the currently stored height, replace the height with this one
}
});
_i.container.css({
'height': _i.containerHeight+'px', // set the outer container to the tallest column's height
'overflow':'hidden'
});
// done.
}
});
})(jQuery);
어떤 도움을 주시면 감사하겠습니다. 여기까지 읽어
감사합니다,
Jannis
테스트를 위해 축소되지 않은 jQuery 버전을 사용하십시오. 훨씬 더 의미있는 오류 메시지를 얻고 실제로 jQuery 라이브러리에서 어떤 코드 행이 오류를 얻고 있는지 알게됩니다. Google은 CDN을 통해 실제로 비공식 버전을 공유하므로 URL에서 '.min'을 삭제하면됩니다. –
이 힌트를 보내 주셔서 감사합니다. 나는 non-min으로 전환했고 그것을 추적하는 것을 도운'object.length' 오류라고 발견했다. 감사. – Jannis