Js双击空白页面返回顶部 这也就是js页面滚动 - Assbbs
Js双击空白页面返回顶部 这也就是js页面滚动代码,但我找了很久也没找出来,后来用了论坛的双击向下滚动页面代码做了修改才实现的 code lang="js" <script language="JavaScript" type="text/JavaScript"> //双击鼠标滚动屏幕的代码…
Js双击空白页面返回顶部 这也就是js页面滚动代码,但我找了很久也没找出来,后来用了论坛的双击向下滚动页面代码做了修改才实现的 code lang="js" <script language="JavaScript" type="text/JavaScript"> //双击鼠标滚动屏幕的代码 var currentpos,timer; function initialize { timer=setInterval "scrollwindow ",30 ; } function sc { clearInterval timer ; } function scrollwindow { currentpos=document.body.scrollTop; window.scroll 0,++currentpos ; if currentpos !=document.body.scrollTop sc ; } document.onmousedown=sc document.ondblclick=initialize </script> /code 这是双击向下滚动的,改成相反的就能双击向上滚动 code lang="js" var currentpos,timer; function initialize { timer=setInterval "scrollwindow ",1 ; } function sc { clearInterval timer ; } function scrollwindow { currentpos=document.body.scrollTop; window.scroll 0,--currentpos ; if currentpos !=document.body.scrollTop sc ; } document.onmousedown=sc document.ondblclick=initialize /code 将滚动去除,变成直接返回顶部 code lang="js" var currentpos,timer; function initialize { timer=setInterval "scrollwindow ",1 ; } function sc { clearInterval timer ; } function scrollwindow { currentpos=document.body.scrollTop; window.scroll 0,-currentpos ; if currentpos !=document.body.scrollTop sc ; } document.onmousedown=sc document.ondblclick=initialize /code 具体效果可以在本站空白页面双击实现