一段js代码

VPS技术分享

一段js代码

2021-12-22 15:06


                                            




本代码可实现ajax正常的刷新,无需手工刷新页面

---------------------------------------------

 

const delay = ms => new Promise(resolve => setTimeout(resolve, ms));

(async () => {

  while (document.documentElement.scrollTop <= document.body.scrollHeight - 500) {

    window.scrollTo(0, document.documentElement.scrollTop + 500);

    await delay(300);

  }

})();