PageSourceSearch

https://kensankyo.org/common/js/top.js

js kensankyo.org collected 2026-09-30 20:48:18 UTC 735 bytes, 25 lines download raw bytes

1function toTopBtn() {
2	return ( window.scrollY !== undefined ) ? window.scrollY: document.documentElement.scrollTop;
3 }
4 
5 //トップに戻るボタンの要素を取得
6 var topButton = document.getElementById( 'pagetop' );
7 
8 //ボタンの表示・非表示
9 window.onscroll = function() {
10	 ( toTopBtn() > 10 ) ? topButton.classList.add( 'pagetop__isshow' ): topButton.classList.remove( 'pagetop__isshow' );
11 };
12 
13 //トップに移動する関数
14 function scrollToTop() {
15	 var scrolled = toTopBtn();
16	 window.scrollTo( 0, Math.floor( scrolled / 2 ) );
17	 if ( scrolled > 0 ) {
18		 window.setTimeout( scrollToTop, 30 );
19	 }
20 };
21 
22 //イベント登録
23 topButton.onclick = function() {
24	 scrollToTop();
25 };

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.