am having a scenario like this below:
In my ui, I will have a textbox. If I have enter a number in the textbox,I need to scroll down to the respective page number.
In Dom
, I will have some divs with the respective id's. If user entered a page number as 5. I will check for 5th div offset in dom and get top value. By using scrollTop It will scrolled to the 5th div.
Here, Issue is after scrolled down to the 5th div. If again, entered a page number as 2. offset top value in negative. Hence,ScrollTop defaultly moved to top.
To reproduce this exactly,Go to page number 7 and again go to page number 3 or 4.
position()
helps too as you have about 80px of controls above container