A dynamic HTML page scrolling down

2019-08-17 03:17发布

问题:

I have a dynamic HTML page built with bootstrap, jqxGrid, calling some server side code to get data. After loading the data, jqxGrid populated, the page scrolls down.

Getting the code from a different developer, not sure where/what caused the page scrolling down.

I searched keyword "scroll" and did not find anything.

My question is a general question: what kind of JS code/css could lead the page to scroll down?

Thanks!

回答1:

$("html, body").animate({scrollTop: "2500"}, 1000); //smooth scrolling 2500px down

Of course you can scroll to whatever element in your html by writing:

scrollTop: $(element).offset().top


回答2:

Look for something like:

<a href="#anchor">Link Text</a>

in your html code and quite possibly some javascript that is accessing it and causing the scroll.