javascript scroll to top of page
//Instant scroll to top of page
window.scrollTo(0, 0);
javascript scroll to top of page
//Instant scroll to top of page
window.scrollTo(0, 0);
js scroll to bottom
window.scrollTo(0,document.body.scrollHeight);
javascript scroll to bottom of div
//scroll to the bottom of "#myDiv"
var myDiv = document.getElementById("myDiv");
myDiv.scrollTop = myDiv.scrollHeight;
javascript detect scroll to bottom of page
function getDocHeight() { // $(document).height() value depends on browser
var D = document;
return Math.max(
D.body.scrollHeight, D.documentElement.scrollHeight,
D.body.offsetHeight, D.documentElement.offsetHeight,
D.body.clientHeight, D.documentElement.clientHeight
);
}
$(window).scroll(function() {
if($(window).scrollTop() + $(window).height() == getDocHeight()) {
alert("bottom!");
}
});
javascript detect scroll to bottom of page
function scrolled(e) {
if (myDiv.offsetHeight + myDiv.scrollTop >= myDiv.scrollHeight) {
scrolledToBottom(e);
}
}
javascript detect scroll to bottom of page
window.onscroll = function(ev) {
if ((window.innerHeight + window.scrollY) >= document.body.scrollHeight) {
// you're at the bottom of the page
}
};
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us