昨日、サイズ変更ナビゲーション バーを作成する方法を見つけようとして、素晴らしい助けを得ることができました。ページを下にスクロールすると、コンテナー div のサイズが適切に変更されますが、ページの上部にスクロールしても何も起こりません。私は Zurb Foundation Framework、Reverie テーマ開発サーバーをここで使用しています: http://dev.bradmagnus.server287.com/
私はかなり必死に助けが必要です!私は、このナビゲーションを理解するのに非常に長い時間を費やしました。あなたの助けと、stackoverflow のこの素晴らしいコミュニティに本当に感謝しています!
これが完全に機能しているフィドルです:http://jsfiddle.net/magnusbrad/pRgNc/8/
問題のjQueryは次のとおりです。
var top = !$(document).scrollTop();
$(window).scroll(function () {
console.log($(document).scrollTop());
if ($(document).scrollTop() === 0 && !top) {
$('div#navigation.fixed').stop().animate({'height':'140px'}, 300);
$('.title-area img').attr('src', 'http://lorempixel.com/output/fashion-q-g-198-67-10.jpg');
$('ul.right').animate({'margin-top':'0'}, 300);
top = true;
} else if (top) {
$('div#navigation.fixed').animate({'height':'40px'}, 300);
$('.title-area img').attr('src', 'http://lorempixel.com/output/fashion-q-c-198-67-6.jpg');
$('ul.right').animate({'margin-top':'-50px'}, 300);
top = false;
}
});