質問編集履歴
3
誤字修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -96,42 +96,6 @@
|
|
96
96
|
|
97
97
|
} ) ;
|
98
98
|
|
99
|
-
// 処理内容↓↓↓
|
100
|
-
|
101
|
-
window.addEventListener('DOMContentLoaded',function(){
|
102
|
-
|
103
|
-
const target={tab1:"first",tab2:"second",tab3:"third",tab4:"four"};
|
104
|
-
|
105
|
-
[].forEach.call(document.querySelectorAll('.tab'),function(x){
|
106
|
-
|
107
|
-
x.addEventListener('click',function(e){
|
108
|
-
|
109
|
-
const slideClass=document.querySelector('#slide').classList;
|
110
|
-
|
111
|
-
[].forEach.call(slideClass,function(x){
|
112
|
-
|
113
|
-
slideClass.remove(x);
|
114
|
-
|
115
|
-
});
|
116
|
-
|
117
|
-
slideClass.add("move-to-"+target[x.id]);
|
118
|
-
|
119
|
-
document.querySelector('.tab.selected').classList.remove('selected');
|
120
|
-
|
121
|
-
x.classList.add('selected');
|
122
|
-
|
123
|
-
});
|
124
|
-
|
125
|
-
});
|
126
|
-
|
127
|
-
});
|
128
|
-
|
129
|
-
// 処理内容↑↑↑
|
130
|
-
|
131
|
-
}, 500 ) ;
|
132
|
-
|
133
|
-
} ) ;
|
134
|
-
|
135
99
|
```
|
136
100
|
|
137
101
|
|
2
リンクURL修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -46,7 +46,7 @@
|
|
46
46
|
|
47
47
|
【resizeイベント導入後 -- jsが動きません↓】
|
48
48
|
|
49
|
-
resizeイベントは[こちら](https://lab.syncer.jp/Web/JavaScript/Snippet/7
|
49
|
+
resizeイベントは[こちら](https://lab.syncer.jp/Web/JavaScript/Snippet/71/)のサイトを参考させていただきました。
|
50
50
|
|
51
51
|
```JavaScript
|
52
52
|
|
1
resizeイベントの記述変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -54,9 +54,47 @@
|
|
54
54
|
|
55
55
|
window.addEventListener( "resize", function () {
|
56
56
|
|
57
|
-
|
57
|
+
if ( timeoutId ) return ;
|
58
58
|
|
59
59
|
timeoutId = setTimeout( function () {
|
60
|
+
|
61
|
+
timeoutId = 0 ;
|
62
|
+
|
63
|
+
// 処理内容↓↓↓
|
64
|
+
|
65
|
+
window.addEventListener('DOMContentLoaded',function(){
|
66
|
+
|
67
|
+
const target={tab1:"first",tab2:"second",tab3:"third",tab4:"four"};
|
68
|
+
|
69
|
+
[].forEach.call(document.querySelectorAll('.tab'),function(x){
|
70
|
+
|
71
|
+
x.addEventListener('click',function(e){
|
72
|
+
|
73
|
+
const slideClass=document.querySelector('#slide').classList;
|
74
|
+
|
75
|
+
[].forEach.call(slideClass,function(x){
|
76
|
+
|
77
|
+
slideClass.remove(x);
|
78
|
+
|
79
|
+
});
|
80
|
+
|
81
|
+
slideClass.add("move-to-"+target[x.id]);
|
82
|
+
|
83
|
+
document.querySelector('.tab.selected').classList.remove('selected');
|
84
|
+
|
85
|
+
x.classList.add('selected');
|
86
|
+
|
87
|
+
});
|
88
|
+
|
89
|
+
});
|
90
|
+
|
91
|
+
});
|
92
|
+
|
93
|
+
// 処理内容↑↑↑
|
94
|
+
|
95
|
+
}, 500 ) ;
|
96
|
+
|
97
|
+
} ) ;
|
60
98
|
|
61
99
|
// 処理内容↓↓↓
|
62
100
|
|