Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
22
rated 0 times [  28] [ 6]  / answers: 1 / hits: 49995  / 13 Years ago, fri, april 15, 2011, 12:00:00

I would like to call functions when the browser window goes beyond a certain point

(e.g the user scrolled the window down beyond 200px from the top



Is there an event I can bind to and then how would I check how much the offset is from the top of the browser to the top of the page?


More From » jquery

 Answers
408

You can use onscroll



function testScroll(ev){
if(window.pageYOffset>400)alert('User has scrolled at least 400 px!');
}
window.onscroll=testScroll


If you want a jQuery solution you can use scroll.


[#92712] Thursday, April 14, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
sidneyh

Total Points: 118
Total Questions: 108
Total Answers: 105

Location: Mali
Member since Fri, Jun 18, 2021
3 Years ago
sidneyh questions
Tue, Jun 7, 22, 00:00, 2 Years ago
Wed, Apr 13, 22, 00:00, 2 Years ago
Wed, Aug 12, 20, 00:00, 4 Years ago
Wed, Jun 3, 20, 00:00, 4 Years ago
Fri, Apr 24, 20, 00:00, 4 Years ago
;