How to trigger a function in Javascript or jquery after i scroll a certain distance from top of the page or bottom? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to trigger a function in Javascript or jquery after i scroll a certain distance from top of the page or bottom?

Javascript challenge

8th Jan 2018, 12:39 PM
Jyoti DAS
Jyoti DAS - avatar
6 Answers
+ 9
https://www.w3schools.com/jsref/event_onscroll.asp see the examples. answers to your challenge await :)
8th Jan 2018, 1:04 PM
jay
jay - avatar
+ 5
Use onscroll event with scrollTop to check for distance from top in pixel https://code.sololearn.com/WwH4sj1zm5B3/?ref=app
8th Jan 2018, 1:29 PM
Calviղ
Calviղ - avatar
+ 3
Can we use 'em' or percentage value in '' scrollTop'' function?
8th Jan 2018, 1:10 PM
Jyoti DAS
Jyoti DAS - avatar
+ 3
Great snippet dude@Calvin
8th Jan 2018, 1:48 PM
Jyoti DAS
Jyoti DAS - avatar
+ 2
Thanks bro @Jay, searching it for 2 days.
8th Jan 2018, 1:08 PM
Jyoti DAS
Jyoti DAS - avatar