ここで JQuery ウェイポイントに少し問題があります。私の1ページサイトでの自動スクロールナビゲーションに使用しています:
スクロール ホイールを使用すると正常に動作します。特定の要素が画面の上部に到達するたびに、ナビゲーション アイテムの色を変更する必要があります。問題は、サインアップ --> について --> サインアップを押したときに、3 回目は色が変わらないことです。
script.js:
$('a[href^="#"]').bind('click.smoothscroll',function (e) {
e.preventDefault();
var target = this.hash,
$target = $(target);
$('html, body').stop().animate({
'scrollTop': $target.offset().top-40
}, 900, 'swing', function () {
window.location.hash = target;
});
});
var currentMenuObject = '';
$('#wrapper').waypoint(function() {
$(currentMenuObject).css('color', '#f2e0bd');
currentMenuObject = '#top';
$(currentMenuObject).css('color', 'black');
}, { offset: '55'});
$('#introarticle').waypoint(function() {
$(currentMenuObject).css('color', '#f2e0bd');
currentMenuObject = '#top';
$(currentMenuObject).css('color', 'black');
}, { offset: '55'});
$('#signsection').waypoint(function() {
$(currentMenuObject).css('color', '#f2e0bd');
currentMenuObject = '#signup';
$(currentMenuObject).css('color', 'black');
}, { offset: '55'});
$('#storyarticle').waypoint(function() {
$(currentMenuObject).css('color', '#f2e0bd');
currentMenuObject = '#about';
$(currentMenuObject).css('color', 'black');
}, { offset: '55'});