PageSourceSearch

https://maitsuki-panda.jp/Js/common.js

js maitsuki-panda.jp collected 2026-10-08 12:39:20 UTC 3,455 bytes, 152 lines download raw bytes

1/* ===========================================
2common.js
3=========================================== */
4(function($){
5"use strict";
6
7
8/* header scroll
9------------------------------------- */
10window.addEventListener("scroll", function () {
11  const header = document.querySelector("header");
12  header.classList.toggle("scroll-nav", window.scrollY > 100);
13});
14
15
16/* smoothScroll
17------------------------------------- */
18$(function() {
19    var menu = $('.btn_entry');    
20    $(window).on('load scroll',function () {
21        if ($(this).scrollTop() > 60) {
22            menu.addClass('active');
23        } else {
24            menu.removeClass('active');
25        }
26    });
27});
28
29/* fixedbtn_area
30------------------------------------- */
31$(function() {
32    var menu = $('.fixedbtn_area');    
33    $(window).on('load scroll',function () {
34        if ($(this).scrollTop() > 60) {
35            menu.addClass('active');
36        } else {
37            menu.removeClass('active');
38        }
39    });
40});
41
42
43
44/* smoothScroll
45------------------------------------- */
46//scroll speed
47
48var speed = 500;
49
50//pagetop btn
51$('a[href="#top"]').on('click',function(){
52	$('body,html').animate({scrollTop:'0'}, speed, 'swing');
53	return false;
54});
55	
56	
57///gloval menu
58	
59$(".btn_menuopen").click(function () {
60  $(this).toggleClass('active');
61    $("#g-nav").toggleClass('panelactive');
62});
63
64$("#g-nav a").click(function () {
65    $(".btn_menuopen").removeClass('active');
66    $("#g-nav").removeClass('panelactive');
67});
68
69
70//other link
71	
72$('a[href^="#"]:not([href="#top"])').on('click',function(){
73	var href= $(this).attr('href');
74	var target = $(href === '#' || href === '' ? 'html' : href);
75	var position = target.offset().top;
76	$('body,html').animate({scrollTop:position}, speed, 'swing');
77	return false;
78});
79
80/* fade appear pagetop btn
81------------------------------------- */
82if($('#pagetop').length){
83	//setting
84	var pagetop = $('#pagetop');
85	
86	//fadeIn / fadeOut
87	$(window).scroll(function(){
88		if($(this).scrollTop() > 300){
89			pagetop.fadeIn('fast');
90		}else{
91			pagetop.fadeOut('fast');
92		}
93	});
94}
95	
96//pcとspで画像切り分け
97$(function() {
98    var $setElem = $('.switch'),
99        pcName = '_pc',
100        spName = '_sp',
101        replaceWidth = 749;
102    $setElem.each(function() {
103        var $this = $(this);
104
105        function imgSize() {
106            if (window.innerWidth > replaceWidth) {
107                $this.attr('src', $this.attr('src').replace(spName, pcName));
108            } else {
109                $this.attr('src', $this.attr('src').replace(pcName, spName));
110            }
111        }
112        $(window).resize(function() { imgSize(); });
113        imgSize();
114    });
115});
116
117
118$(function() {
119    var menu = $('.entry_area');    
120    $(window).on('load scroll',function () {
121        if ($(this).scrollTop() > 100) {
122            menu.addClass('active');
123        } else {
124            menu.removeClass('active');
125        }
126    });
127});
128
129
130
131/* toggle
132------------------------------------- */
133if($('.tit-toggle').length){
134	$('.tit-toggle').on('click',function(){
135		$(this).toggleClass('on');
136		$(this).next('.content-toggle').slideToggle('fast');
137	});
138}
139	
140/* menu_close
141------------------------------------- */
142	
143$('#menu a[href]').on('click', function(event){
144        $('#nav-toggle').trigger('click');
145    });
146
147
148
149
150
151})(jQuery);
152

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.