IT業界の技術をメモ・情報公開できる

jqueryでウィンドウ最下部判定

登録日:2026-01-08    更新日:2026-01-13
jquery
$(window).on('scroll', function () {
const scrollTop = $(window).scrollTop();
const windowHeight = $(window).height();
const documentHeight = $(document).height();

if (scrollTop + windowHeight >= documentHeight) {
$('#target').fadeOut();
} else {
$('#target').fadeIn();
}
});

一覧に戻る