//在滚动鼠标后重新赋值滚动后页面的顶端,以防需要使用鼠标调整位置的情况 window.onscroll = function () { currentTop = document.documentElement.scrollTop; };
window.addEventListener( "keydown", function (event) { if (event.defaultPrevented) { return; // Should do nothing if the default action has been cancelled }
var handled = false; if (event.key !== undefined) { // Handle the event with KeyboardEvent.key and set handled true. switch (event.key) { case"Enter": clearInterval(time); time = setInterval(AutoScroll, speed); console.log("start"); break; case"Escape": clearInterval(time); console.log("stop");