javascript

位置:IT落伍者 >> javascript >> 浏览文章

纯文字版返回顶端的js


发布日期:2018年06月18日
 
纯文字版返回顶端的js

<script language="javascript">var goto_top_type = ;var goto_top_itv = ;function goto_top_timer() {var y = goto_top_type == ? documentdocumentElementscrollTop: documentbodyscrollTop;var moveby = ;y = Mathceil(y * moveby / );if (y < ) {y = ;}if (goto_top_type == ) {documentdocumentElementscrollTop = y;} else {documentbodyscrollTop = y;}if (y == ) {clearInterval(goto_top_itv);goto_top_itv = ;}}function goto_top() {if (goto_top_itv == ) {if (documentdocumentElement && documentdocumentElementscrollTop) {goto_top_type = ;} else if (documentbody && documentbodyscrollTop) {goto_top_type = ;} else {goto_top_type = ;}if (goto_top_type > ) {goto_top_itv = setInterval(goto_top_timer() );}}}</script><a href="javascript:void()" onclick="goto_top()">【返回顶部】</a>

上一篇:javascript跟随滚动效果插件代码(javascript Follow Plugin)

下一篇:JavaScript实现QueryString获取GET参数的方法