Вот ответ
HTML
<a id="scroll_to_top_id"></a>
CSS
#scroll_to_top_id {
display: none;
position: fixed;
right: 30px;
bottom: 30px;
background
}
PURE JAVASCRIPT (NO Jquery)
/*
* Scroll To Top
*/
var your_header = document.getElementById('header_id'),
scroll_to_top = document.getElementById('scroll_to_top_id');
window.onscroll = function(ev) {
var scrollTop = window.pageYOffset || document.body.scrollTop;
if (scrollTop > your_header.offsetHeight + 100) {
scroll_to_top.style.display = 'block';
}
else{
scroll_to_top.style.display = 'none';
}
};
scroll_to_top.onclick = function() {
scrollTo(document.body, 0, 100);
}
/*
* scroll to body top
* element, position and time duration
*/
function scrollTo(element, to, duration) {
if (duration < 0) return;
var difference = to - element.scrollTop;
var perTick = difference/duration * 2;
setTimeout(function() {
element.scrollTop = element.scrollTop + perTick;
scrollTo(element, to, duration - 2);
}, 10);
}
Я думаю, что этот ответ поможет вам: [link] (http://stackoverflow.com/questions/3898130/check-if-a-user-has-scrolled-to-the-bottom) –