https://www.softel.co.jp/blogs/tech/archives/demo/d20120309
$(window).bind(“scroll”, function() {
scrollHeight = $(document).height();
scrollPosition = $(window).height() + $(window).scrollTop();
if ( (scrollHeight – scrollPosition) / scrollHeight <= 0.05) {
//スクロールの位置が下部5%の範囲に来た場合
$('body').css('background', '#cc0000');
} else {
//それ以外のスクロールの位置の場合
$('body').css('background', '#eeeeee');
}
});