javascript get scroll position
snippet in javascript

javascript get scroll position

user8648

function getYPosition(){
  var top  = window.pageYOffset || document.documentElement.scrollTop
  return top;
}

window log scrollpostion

user5366

$(window).on('scroll', function() {
    console.log( $(this).scrollTop() );
});

scroll position

user8238

$(window).scroll(function() {
	var $height = $(window).scrollTop();
  if($height > 50) {
		//do something
	} else {
		//do something
	}
});