JavaScript Obtenha posição de rolagem
function getYPosition(){
var top = window.pageYOffset || document.documentElement.scrollTop
return top;
}
Phil the ice cream man
function getYPosition(){
var top = window.pageYOffset || document.documentElement.scrollTop
return top;
}
$(window).on('scroll', function() {
console.log( $(this).scrollTop() );
});
let scrollLeft = window.pageXOffset || document.documentElement.scrollLeft,
scrollTop = window.pageYOffset || document.documentElement.scrollTop;Code language: JavaScript (javascript)
document.documentElement.scrollTop = document.body.scrollTop = 1200;
document.documentElement.scrollLeft = document.body.scrollLeft = 600;Code language: JavaScript (javascript)