PageSourceSearch

https://minpo.or.jp/asset/front/js/header-sticky.js?t=5

js minpo.or.jp collected 2026-10-05 09:43:00 UTC 4,173 bytes, 143 lines download raw bytes

1// Header fixed
2// ==========================================================================
3$(function () {
4    var header = $("header");
5    $(window).scroll(function () {
6        if ($(this).scrollTop()) {
7            header.addClass('sticky');
8        } else {
9            header.removeClass('sticky');
10        }
11    });
12});
13$(document).ready(function () {
14    $("body").removeClass("menu-open");
15});
16
17
18function closeMenu() {
19    $('#gnav_sp').slideUp();
20    $('body').removeClass('menu-open');
21    $('#trigger-menu').removeClass('active');
22}
23
24function openMenu() {
25    $('#gnav_sp').slideDown();
26    $('body').addClass('menu-open');
27    $('#trigger-menu').addClass('active');
28}
29// Slide down menu on click
30// ==========================================================================
31// $(window).on('load resize', function() {
32// 	if ($(window).width() < 1200) {
33// 		closeMenu();
34// 	}
35// });
36
37$(document).ready(function() {
38	// if ($(window).width() < 980) {
39	// 	closeMenu();
40	// }
41	$("#trigger-menu").click(function() {
42		var isHidden = $("#gnav_sp").is(":hidden");
43		if (isHidden) {
44			openMenu();
45		} else {
46			closeMenu();
47		}
48	});
49
50	// close menu when click outside
51	// $(document).click(function(event) {
52    //     if (!$(event.target).closest("#gnav_sp").length && !$(event.target).closest("#trigger-menu").length) {
53	// 		closeMenu();
54    //     }
55	// });
56});
57
58// Equal height
59// ==========================================================================
60equalheight = function (container) {
61    var currentTallest = 0,
62        currentRowStart = 0,
63        rowDivs = new Array(),
64        $el,
65        topPosition = 0;
66    jQuery(container).each(function () {
67        $el = jQuery(this);
68        jQuery($el).height("auto");
69        topPostion = $el.position().top;
70        if (currentRowStart != topPostion) {
71            for (currentDiv = 0; currentDiv < rowDivs.length; currentDiv++) {
72                rowDivs[currentDiv].height(currentTallest);
73            }
74            rowDivs.length = 0;
75            currentRowStart = topPostion;
76            currentTallest = $el.height();
77            rowDivs.push($el);
78        } else {
79            rowDivs.push($el);
80            currentTallest = currentTallest < $el.height() ? $el.height() : currentTallest;
81        }
82        for (currentDiv = 0; currentDiv < rowDivs.length; currentDiv++) {
83            rowDivs[currentDiv].height(currentTallest);
84        }
85    });
86};
87jQuery(window).on("load", function () {
88    equalheight(".quick_links ul li a");
89    equalheight("footer .f_links .nav_wrap");
90});
91jQuery(window).on("resize", function () {
92    equalheight(".quick_links ul li a");
93    equalheight("footer .f_links .nav_wrap");
94});
95
96
97// Follow nav active on scroll or click
98// ==========================================================================
99
100// Footer f-links
101// ==========================================================================
102$(document).ready(function () {
103    if ($(window).width() < 1200) {
104        $(".sub_links").slideUp();
105        
106        $(".f_links .nav_wrap ul li a.acc").on("click", function (e) {
107            var $acc = $(this).closest("li");
108            var clickX = e.offsetX;
109            var linkWidth = $(this).width();
110            if (clickX > linkWidth - 40) {
111                e.preventDefault(); 
112                
113                if ($acc.hasClass("open")) {
114                    $acc.removeClass("open");
115                    $acc.find(".sub_links").slideUp();
116                } else {
117                    $acc.addClass("open");
118                    $acc.children(".sub_links").slideDown();
119                    $acc.siblings("li").removeClass("open").children(".sub_links").slideUp();
120                }
121            }
122        });
123    } else {
124        $(".sub_links").slideDown();
125    }
126});
127
128
129// Table arrow hide on scroll
130$(document).ready(function () {
131	const $tb_body = $('.tb_wrap');
132	const $tb_arrow = $('.tb-arrow');
133
134	$tb_body.on('scroll', function () {
135		if ($tb_body.scrollLeft() > 0) {
136			// Hide the element on horizontal scroll
137			$tb_arrow.css('opacity', 0)
138		} else {
139			// Show the element if scrolled back to start
140			$tb_arrow.css('opacity', 1)
141		}
142	});
143});

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.