質問編集履歴
2
画像の修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
### 発生している問題・分からないこと
|
11
11
|
画像、CSSがサイトに反映されない
|
12
12
|

|
13
|
-

|
14
14
|
|
15
15
|
|
16
16
|
### 該当のソースコード
|
1
コード、スクショの追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -9,16 +9,167 @@
|
|
9
9
|
|
10
10
|
### 発生している問題・分からないこと
|
11
11
|
画像、CSSがサイトに反映されない
|
12
|
+

|
13
|
+

|
12
14
|
|
13
15
|
|
16
|
+
### 該当のソースコード
|
17
|
+
<!DOCTYPE html>
|
18
|
+
<html lang="ja">
|
19
|
+
<head>
|
20
|
+
<meta charset="UTF-8">
|
21
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
22
|
+
|
23
|
+
<title>portfolio</title>
|
24
|
+
|
25
|
+
<!-- リセットCSS 読み込み -->
|
26
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/destyle.css@3.0.2/destyle.css">
|
27
|
+
|
28
|
+
<!-- style.css 読み込み -->
|
29
|
+
<link rel="stylesheet" href="./css/style.css">
|
14
30
|
|
31
|
+
<!--google fonts 読み込み-->
|
32
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
33
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
34
|
+
<link href="https://fonts.googleapis.com/css2?family=Lexend:wght@100..900&family=Noto+Sans+JP:wght@100..900&display=swap" rel="stylesheet">
|
15
35
|
|
16
|
-
|
36
|
+
<!-- font awesome-->
|
37
|
+
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.4/css/all.css">
|
17
38
|
|
18
|
-
|
39
|
+
<!-- jQuery本体 -->
|
19
|
-
|
40
|
+
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
20
|
-
```
|
21
41
|
|
42
|
+
<!-- kv_title / kv_txt アニメーション -->
|
43
|
+
<script>
|
44
|
+
$(document).ready(function () {
|
45
|
+
// 最初に非表示
|
46
|
+
$('.kv_title, .kv_txt p').css('visibility', 'hidden');
|
47
|
+
|
48
|
+
function animateText($element, baseDelay = 0, onComplete = null) {
|
49
|
+
const originalHtml = $element.html();
|
50
|
+
const container = $('<div>').html(originalHtml);
|
51
|
+
let index = 0;
|
52
|
+
|
53
|
+
function wrap(node) {
|
54
|
+
if (node.nodeType === 3) {
|
55
|
+
return node.nodeValue.split('').map(char => {
|
56
|
+
const delay = index * 50 + baseDelay;
|
57
|
+
const span = $('<span>').text(char).attr('style',
|
58
|
+
`opacity:0; display:inline-block; transform:translateY(20px); transition:all 0.5s ease ${delay}ms;`
|
59
|
+
);
|
60
|
+
index++;
|
61
|
+
return span[0].outerHTML;
|
62
|
+
}).join('');
|
63
|
+
} else if (node.nodeType === 1) {
|
64
|
+
const tag = node.tagName.toLowerCase();
|
65
|
+
const classAttr = node.className ? ` class="${node.className}"` : '';
|
66
|
+
const inner = Array.from(node.childNodes).map(child => wrap(child)).join('');
|
67
|
+
return `<${tag}${classAttr}>${inner}</${tag}>`;
|
68
|
+
}
|
69
|
+
return '';
|
70
|
+
}
|
71
|
+
|
72
|
+
const newHtml = Array.from(container[0].childNodes).map(node => wrap(node)).join('');
|
73
|
+
$element.html(newHtml);
|
74
|
+
|
75
|
+
setTimeout(() => {
|
76
|
+
$element.find('span').each(function () {
|
77
|
+
$(this).css({
|
78
|
+
opacity: 1,
|
79
|
+
transform: 'translateY(0)'
|
80
|
+
});
|
81
|
+
});
|
82
|
+
|
83
|
+
const totalDelay = index * 50 + baseDelay;
|
84
|
+
if (typeof onComplete === 'function') {
|
85
|
+
setTimeout(onComplete, totalDelay);
|
86
|
+
}
|
87
|
+
}, baseDelay);
|
88
|
+
}
|
89
|
+
|
90
|
+
// ① kv_title を先にアニメーション
|
91
|
+
$('.kv_title').css('visibility', 'visible');
|
92
|
+
animateText($('.kv_title'), 0, function () {
|
93
|
+
// ② 完了後に kv_txt p をアニメーション
|
94
|
+
$('.kv_txt p').css('visibility', 'visible');
|
95
|
+
animateText($('.kv_txt p'), 0);
|
96
|
+
});
|
97
|
+
});
|
98
|
+
</script>
|
99
|
+
|
100
|
+
<script>
|
101
|
+
$(document).ready(function () {
|
102
|
+
function showOnScroll() {
|
103
|
+
$('.work-item').each(function () {
|
104
|
+
const top = $(this).offset().top;
|
105
|
+
const scroll = $(window).scrollTop();
|
106
|
+
const windowHeight = $(window).height();
|
107
|
+
|
108
|
+
if (scroll + windowHeight > top + 50) {
|
109
|
+
$(this).addClass('show');
|
110
|
+
}
|
111
|
+
});
|
112
|
+
}
|
113
|
+
|
114
|
+
$(window).on('scroll', showOnScroll);
|
115
|
+
$(window).on('load', showOnScroll);
|
116
|
+
});
|
117
|
+
</script>
|
118
|
+
|
119
|
+
<!-- jQueryハンバーガー -->
|
120
|
+
<script>
|
121
|
+
$(function(){
|
122
|
+
const $btn = $('.hamburger');
|
123
|
+
const $drawer = $('#global-drawer');
|
124
|
+
const $backdrop = $('.drawer-backdrop');
|
125
|
+
const $focusable = 'a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])';
|
126
|
+
let lastFocused = null;
|
127
|
+
|
128
|
+
function openDrawer() {
|
129
|
+
lastFocused = document.activeElement;
|
130
|
+
$btn.addClass('is-active').attr('aria-expanded', 'true');
|
131
|
+
$drawer.addClass('is-open').attr('aria-hidden', 'false');
|
132
|
+
$backdrop.addClass('is-open');
|
133
|
+
$('body').addClass('no-scroll');
|
134
|
+
|
135
|
+
// 最初のフォーカス
|
136
|
+
const $first = $drawer.find($focusable).first();
|
137
|
+
if ($first.length) { $first.focus(); }
|
138
|
+
}
|
139
|
+
|
140
|
+
function closeDrawer() {
|
141
|
+
$btn.removeClass('is-active').attr('aria-expanded', 'false');
|
142
|
+
$drawer.removeClass('is-open').attr('aria-hidden', 'true');
|
143
|
+
$backdrop.removeClass('is-open');
|
144
|
+
$('body').removeClass('no-scroll');
|
145
|
+
|
146
|
+
// 元の場所へフォーカス戻す
|
147
|
+
if (lastFocused) { $(lastFocused).focus(); }
|
148
|
+
}
|
149
|
+
|
150
|
+
$btn.on('click', function(){
|
151
|
+
const expanded = $(this).attr('aria-expanded') === 'true';
|
152
|
+
if (expanded) { closeDrawer(); } else { openDrawer(); }
|
153
|
+
});
|
154
|
+
|
155
|
+
// オーバーレイ/リンククリックで閉じる
|
156
|
+
$backdrop.on('click', closeDrawer);
|
157
|
+
$('#global-drawer .drawer-link, #global-drawer .drawer-cta').on('click', closeDrawer);
|
158
|
+
|
159
|
+
// 閉じるボタンでも閉じる
|
160
|
+
$('.drawer-close').on('click', closeDrawer);
|
161
|
+
|
162
|
+
// ESCで閉じる
|
163
|
+
$(document).on('keydown', function(e){
|
164
|
+
if (e.key === 'Escape' && $drawer.hasClass('is-open')) {
|
165
|
+
e.preventDefault(); closeDrawer();
|
166
|
+
}
|
167
|
+
});
|
168
|
+
});
|
169
|
+
</script>
|
170
|
+
</head>
|
171
|
+
|
172
|
+
|
22
173
|
### 試したこと・調べたこと
|
23
174
|
- [x] teratailやGoogle等で検索した
|
24
175
|
- [x] ソースコードを自分なりに変更した
|
@@ -29,4 +180,4 @@
|
|
29
180
|
Googleで色々と調べてやっていますが分かりません
|
30
181
|
|
31
182
|
### 補足
|
32
|
-
特になし
|
183
|
+
特になし
|