The Garrison Golf Club

test page

196
down vote
accepted

Initially, Grab the .offset position of the element and calculate it’s relative position with respect to window

Refer :
1. offset
2. scroll
3. scrollTop

You can give it a try at this fiddle

Following few lines of code explains how this can be solved

when .scroll event is performed, we calculate the relative position of the element with respect to window object

$(window).scroll(function () {
console.log(eTop – $(window).scrollTop());
});

when scroll is performed in browser, we call the above event handler function

The Garrison
2015 US 9 Garrison, New York 10524
phone: (845) 424-3604
Fax: (845) 424-3685
info@thegarrison.com

196
down vote
accepted

Initially, Grab the .offset position of the element and calculate it’s relative position with respect to window

Refer :
1. offset
2. scroll
3. scrollTop

You can give it a try at this fiddle

Following few lines of code explains how this can be solved

when .scroll event is performed, we calculate the relative position of the element with respect to window object

$(window).scroll(function () {
console.log(eTop – $(window).scrollTop());
});

when scroll is performed in browser, we call the above event handler function

The Garrison
2015 US 9 Garrison, New York 10524
phone: (845) 424-3604
Fax: (845) 424-3685
info@thegarrison.com
Skip to content