Position scroll - Jquery - JS

Asked

Viewed 662 times

0

Hello,

I’m having trouble making a script in which I have the following structure

Where the header and footer are fixed and the main has a scroll with the content. I would like to know how to get the position of the main scroll?

Thank you

1 answer

2

Index the method scrollTop within its element #main. It will return to vertical position. You can index the scrollLeft if you want the horizontal position.

var $main = $('#main');
$main.scrollTop();

(i hope you are talking from the native scroll)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.