PageSourceSearch

https://okinawa-ric.jp/js/scroll_top.js

js okinawa-ric.jp collected 2026-10-02 07:49:39 UTC 2,905 bytes, 99 lines download raw bytes

1$(function() {
2    var showClass = 'show';
3    var hideClass = 'hide';
4    var staticClass = 'static';
5    var hideCSS = {
6      'z-index': '-1',
7      'visibility': 'hidden',
8    }
9    var pagetopShowTrig = 100;
10
11    var pagetop = $('#pagetop');
12    var pagetopCloneStatic = pagetop.clone().attr('id', '').addClass(staticClass).css(hideCSS);
13    var pagetopCloneFixed = pagetop.clone().attr('id', '').addClass(showClass).css(hideCSS);
14    pagetop.after(pagetopCloneStatic, pagetopCloneFixed);
15
16    $(window).on('load scroll', function() {
17      var scroll = $(window).scrollTop();
18      if(scroll >= pagetopShowTrig) {
19        if(!pagetop.hasClass(showClass)) {
20          pagetop.addClass(showClass).removeClass(hideClass);
21        }
22      } else {
23        if(pagetop.hasClass(showClass)) {
24          pagetop.removeClass(showClass).addClass(hideClass);
25        }
26      }
27      if(pagetopCloneStatic.offset().top <= pagetopCloneFixed.offset().top) {
28        if(!pagetop.hasClass(staticClass)) {
29          pagetop.addClass(staticClass);
30        }
31      } else {
32        if(pagetop.hasClass(staticClass)) {
33          pagetop.removeClass(staticClass);
34        }
35      }
36    });
37
38	var TopBtn = $('#pagetop');   
39
40	//ボタンを押下するとトップへ移動
41	TopBtn.click(function() {
42		$('body,html').animate({
43			scrollTop: 0
44		}, 300);
45		return false;
46	});
47});
48
49/*
50$(function() {
51	var TopBtn = $('#PageTopBtn');   
52	var BottomPos = 0; // ボタンの画面下からの位置を指定
53	TopBtn.hide();
54	$(window).scroll(function(e) {
55		$window = $(e.currentTarget);
56		WindowHeight = $window.height(); // ウィンドウの高さ
57		PageHeight = $(document).height(); // ページの高さ
58		footerHeight = $(".footer").height(); // フッタの高さ
59		ScrollTop = $window.scrollTop(); // スクロールした量
60		MoveTopBtn = WindowHeight + ScrollTop + footerHeight - PageHeight;
61
62		//スクロール位置が100でボタンを表示
63		if ($(this).scrollTop() > 100) {
64			TopBtn.fadeIn();
65		} 
66		else {
67			TopBtn.fadeOut();
68		}
69
70		// フッターまでスクロールするとボタンを移動
71		if(ScrollTop >= PageHeight - WindowHeight - footerHeight + BottomPos) {
72			TopBtn.css({ bottom: MoveTopBtn });
73		}
74		else {
75			TopBtn.css({ bottom: BottomPos });
76		}	
77	});
78	//ボタンを押下するとトップへ移動
79	TopBtn.click(function() {
80		$('body,html').animate({
81			scrollTop: 0
82		}, 300);
83		return false;
84	});
85});
86
87    $(function(){
88        $('a[href^=#]').click(function(){
89            var speed = 500;
90            var href= $(this).attr("href");
91            var target = $(href == "#" || href == "" ? 'html' : href);
92            var position = target.offset().top;
93            $("html, body").animate({scrollTop:position}, speed, "swing");
94            return false;
95        });
96    });
97*/
98
99

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.