I have a web page that basically contains a large table, I use ajax to automatically create and populate the table every minute. the basic code structure is like this:
$(document).ready(function(){
setInterval(function(){
$.ajax({
//code to call backend, get the data,
//create/populate the table, and refresh every minute
});
});
}
Since the table is quite long, I'd like to have it automatically scroll down, pause a couple of second,continue to scroll down, pause again. And when it reaches the end, it will scroll up, pause...or maybe once it reaches the end, start from the top and do it all over again. While it's scrolling, I'd also like to to keep its table header row fixed at the top.
My questions are:
- is it possible to do this using some jquery function or javascript?
- how would this automatic scrolling function interfere with the ajax? say it's in the middle of scrolling down and it's time for ajax table refresh?