javascript get scroll position

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

4
7
Phoenix Logan 186120 points

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

4 (7 Votes)
0
3.71
7
A-312 69370 points

                                    document.documentElement.scrollTop = document.body.scrollTop = 1200;
document.documentElement.scrollLeft = document.body.scrollLeft = 600;Code language: JavaScript (javascript)

3.71 (7 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
get scroll position element javascript get page scroll position how to get scroll position of an element html js window get scroll position document scroll position javascript js get current scroll position how to know the scroll position in js what is the scroll position on html how to get current scroll position in javascript get window scroll position javascript js get scroll position of window get document scroll position get the position of scrollbar in javascript js check scroll position javascript current scroll position get current position to scroll js how to get element scroll position javascript how to get the current scroll position in javascript get scroll position css js get window scroll position window get scroll position javascript get scroll position of element html javascript window find scroll position javascript dom scroll position get the current scroll position in javascrit get current scroll position javascript determine where scroll position in javascript javascript get scroll position of div javascript find scroll position js get scoll position of element how to take current scroll position in js js get scroll element div position get the scroll position javascript get scroll y position on scroll get scroll position get scroll position of element js get window scroll position js javascript get current scroll position scrolled position javascript get document scroll position js get element scroll position javascript get window scroll position javascript document scroll position get scroll y position javascript html get current scroll position how to grab current scroll position javscript get page scroll position javascript get position of scroll javascript css scroll position current scroll position javascript get scroll position in js get scroll position of element js find scroll position how to get window scroll position javascript scroll position elemen javascript get scroll position from top get window scroll position js get body scroll position vanilla javascript get scroll position detect croll position js get scroll position of document get window current scroll position get y scroll position get page y scroll in js scrolltop() top of window scroll track scrolling value javascript getting scrolling value in javascript javascript scroll value scroll offset javascript get scroll box position how to get scrolltop position in javascript javascript check window scroll position javascript check scroll position js get scroll amount javascript scroll value scroll position js get scroll value javascript calculate scroll position javascript how to get scroll value in javascript js know % of scroll find scroll position scroll y position javascript js get scroll offset how to get scroll position in javascript get window position on scroll javascript get scroll offset how to check scroll position with javascript es6 find scroll top get scroll position js js scroll offset how to get scroll position javascript how to get scroll position js scroll position scroll position es6 get window scrolltop scroll offset js how to know scroll position javascript check window scroll position scroll in div javascript get y offset javascript scroll get scroll position javascript get scrollbar position javascript get scroll y posiiton get the scroll position in javascript how to get the scroll position in javascript detect position scroll javascript how to get window scroll position in javascript how to find window scroll in javascript get scroll position javascript div detect scroll position javascript get vertical scroll position javascript javascript vertical scroll position get current y position javascript javascript see scroll position js get scroll position js get document scroll position js how to detect the scoll postion javascript detect scroll position javascript how to get scroll position how to get offset position scrollbar js scrollpostiion javscrupt get elements scroll position get page scroll position js detect scroll position check scroll position javascript get scroll position javascript javascript scrolling position javascript scroll position scroll position javascript javascript get scroll position
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source