質問編集履歴
1
htmlの一部とjsのコードを追加しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -20,7 +20,118 @@
|
|
20
20
|
|
21
21
|
|
22
22
|
```
|
23
|
+
```html
|
24
|
+
<section id="profile">
|
25
|
+
<h2 class="fadein-x-h2">
|
26
|
+
profile
|
27
|
+
</h2>
|
28
|
+
<div class="flex__herf">
|
29
|
+
<div class="profile__text fadein">
|
30
|
+
<p class="font__optima sytle-bottom15 textl">
|
31
|
+
ロゴ
|
32
|
+
</p>
|
33
|
+
<p class="texts sytle-bottom15">
|
34
|
+
テキストテキストテキスト
|
35
|
+
</p>
|
36
|
+
</div>
|
37
|
+
<div class="profile__img fadein">
|
38
|
+
<p class="profile__img--01">
|
39
|
+
<img src="images/profile01.jpg" alt="プロフィール01">
|
40
|
+
</p>
|
41
|
+
<p class="profile__img--02">
|
42
|
+
<img src="images/profile02.jpg" alt="プロフィール02">
|
43
|
+
</p>
|
44
|
+
</div>
|
45
|
+
</div>
|
46
|
+
</section>
|
47
|
+
```
|
48
|
+
```js
|
49
|
+
// 読み込み時のフェードイン
|
50
|
+
$('head').append(
|
51
|
+
'<style>body{display:none;}'
|
52
|
+
);
|
53
|
+
$(window).on("load", function() {
|
54
|
+
$('body').delay(600).fadeIn("slow");
|
55
|
+
});
|
23
56
|
|
57
|
+
// 上下フェードイン
|
58
|
+
$(function(){
|
59
|
+
$(window).scroll(function (){
|
60
|
+
$('.fadein').each(function(){
|
61
|
+
var targetElement = $(this).offset().top;
|
62
|
+
var scroll = $(window).scrollTop();
|
63
|
+
var windowHeight = $(window).height();
|
64
|
+
if (scroll > targetElement - windowHeight + 200){
|
65
|
+
$(this).css('opacity','1');
|
66
|
+
$(this).css('transform','translateY(0)');
|
67
|
+
}
|
68
|
+
});
|
69
|
+
});
|
70
|
+
});
|
71
|
+
|
72
|
+
|
73
|
+
// 左右フェードイン
|
74
|
+
$(function(){
|
75
|
+
$(window).scroll(function (){
|
76
|
+
$('.fadein-x').each(function(){
|
77
|
+
var targetElement = $(this).offset().top;
|
78
|
+
var scroll = $(window).scrollTop();
|
79
|
+
var windowHeight = $(window).height();
|
80
|
+
if (scroll > targetElement - windowHeight + 200){
|
81
|
+
$(this).css('opacity','1');
|
82
|
+
$(this).css('transform','translateX(0)');
|
83
|
+
}
|
84
|
+
});
|
85
|
+
});
|
86
|
+
});
|
87
|
+
|
88
|
+
// 左右フェードイン-h1用(opacityがちがう)
|
89
|
+
$(function(){
|
90
|
+
$(window).scroll(function (){
|
91
|
+
$('.fadein-x-h2').each(function(){
|
92
|
+
var targetElement = $(this).offset().top;
|
93
|
+
var scroll = $(window).scrollTop();
|
94
|
+
var windowHeight = $(window).height();
|
95
|
+
if (scroll > targetElement - windowHeight + 200){
|
96
|
+
$(this).css('opacity','.6');
|
97
|
+
$(this).css('transform','translateX(0)');
|
98
|
+
}
|
99
|
+
});
|
100
|
+
});
|
101
|
+
});
|
102
|
+
|
103
|
+
|
104
|
+
jQuery(function() {
|
105
|
+
var pagetop = $('#page_top');
|
106
|
+
pagetop.hide();
|
107
|
+
$(window).scroll(function () {
|
108
|
+
if ($(this).scrollTop() > 100) { //100pxスクロールしたら表示
|
109
|
+
pagetop.fadeIn();
|
110
|
+
} else {
|
111
|
+
pagetop.fadeOut();
|
112
|
+
}
|
113
|
+
});
|
114
|
+
pagetop.click(function () {
|
115
|
+
$('body,html').animate({
|
116
|
+
scrollTop: 0
|
117
|
+
}, 500); //0.5秒かけてトップへ移動
|
118
|
+
return false;
|
119
|
+
});
|
120
|
+
});
|
121
|
+
|
122
|
+
//—しゅーっと移動するver
|
123
|
+
$(function(){
|
124
|
+
$('a[href^="#"]').click(function(){
|
125
|
+
var time = 500;
|
126
|
+
var href= $(this).attr("href");
|
127
|
+
var target = $(href == "#" ? 'html' : href);
|
128
|
+
var distance = target.offset().top;
|
129
|
+
$("html, body").animate({scrollTop:distance}, time, "swing");
|
130
|
+
return false;
|
131
|
+
});
|
132
|
+
});
|
133
|
+
|
134
|
+
```
|
24
135
|
### 該当のソースコード CSS
|
25
136
|
|
26
137
|
```ここに言語名を入力
|