PageSourceSearch

http://gsola.cn/js/backtop.js

js gsola.cn collected 2026-10-07 19:41:07 UTC 1,082 bytes, 45 lines download raw bytes

1
2//返回顶部--------------------------
3
4//页在加载完后触发
5window.onload = function(){
6    var obtn = document.getElementById('btn');
7    //获取页面可视区的高度
8    var clientHeight = document.documentElement.clientHeight;
9    var timer = null;
10    var isTop = true;
11
12
13	//滚动条滚动时触发
14	window.onscroll = function(){
15		var osTop = document.documentElement.scrollTop ||document.body.scrollTop;
16		if(osTop >= clientHeight){
17			obtn.style.display = 'block';
18		}else{
19			obtn.style.display = 'none';
20		}
21
22		if(!isTop){
23			clearInterval(timer);
24		}
25		isTop = false;
26	}
27	obtn.onclick = function(){
28		
29		//设置定时器
30		timer = setInterval(function(){
31			//获取滚动条距离顶部的高度
32		var osTop = document.documentElement.scrollTop ||document.body.scrollTop;
33		var ispeed = Math.floor(-osTop / 6) ;
34		document.documentElement.scrollTop = document.body.scrollTop -= osTop + ispeed;
35
36		isTop = true;
37		console.log(osTop -ispeed);
38		if(osTop == 0){
39			clearInterval(timer);
40		    }
41		},30);
42		
43	}
44}
45		

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.