下手な英語で申し訳ありませんが、問題のある質問があります。
ここに私が持っているメッセージがあります:
Uncaught TypeError: Cannot read property 'top' of undefined
ここに私の機能があります:
function onScroll(event){
var scrollPos = $(document).scrollTop();
$('#menu-center a').each(function () {
var currLink = $(this);
var refElement = $(currLink.attr("href"));
if (refElement.position().top<= scrollPos && refElement.position().top + refElement.heig
ht() > scrollPos) {
$('#menu-center ul li a').removeClass("active");
currLink.addClass("active");
}
else{
currLink.removeClass("active");
}
});
}
この機能を使用してローカルに別のページがあり、正常に動作しているため、わかりません。
ウェブで検索しましたが、私の問題に対応するものはありません。
ご協力いただきありがとうございます