Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Measuring the window offset

Is there a way to measure the offset of the window in jQuery, in order than I might compare the positions of a 'fixed' element and a relatively positioned one?

I need to be able to tell how far the window is scrolled so I can use the figure to calculate the difference between the height of the fixed element (which is relative to the viewport top) and the relative object (which is relative to the top of the document)

like image 263
Mild Fuzz Avatar asked May 17 '26 10:05

Mild Fuzz


1 Answers

$(window).scrollTop() and $(window).scrollLeft() can be used to find scroll positions.

like image 105
David Wick Avatar answered May 19 '26 00:05

David Wick



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!