質問編集履歴

1

インデントが見づらかったため、修正しました。

2017/11/22 10:18

投稿

sogatake
sogatake

スコア12

test CHANGED
File without changes
test CHANGED
@@ -14,24 +14,28 @@
14
14
 
15
15
  ###該当のソースコード
16
16
 
17
- const target = document.getElementById('foo');
17
+ ```Javascript
18
18
 
19
- // オブザーバインスタンスを作成
19
+ const target = document.getElementById('foo');
20
20
 
21
- const observer = new MutationObserver((mutations) => {
21
+ // オブザーバインスタンスを作成
22
22
 
23
- mutations.forEach((mutation) => {
23
+ const observer = new MutationObserver((mutations) => {
24
24
 
25
- if ( !$('#foo').hasClass('bar') ) {
25
+ mutations.forEach((mutation) => {
26
26
 
27
- $('#hoge').fadeIn();
27
+ if ( !$('#foo').hasClass('bar') ) {
28
28
 
29
- } else {
29
+ $('#hoge').fadeIn();
30
30
 
31
- $('#hoge').fadeOut();
31
+ } else {
32
32
 
33
- }
33
+ $('#hoge').fadeOut();
34
34
 
35
- });
35
+ }
36
36
 
37
- });
37
+ });
38
+
39
+ });
40
+
41
+ ```