質問編集履歴

1

インデントを追加しました。

2017/06/28 15:10

投稿

no23h
no23h

スコア49

test CHANGED
File without changes
test CHANGED
@@ -18,33 +18,29 @@
18
18
 
19
19
  $(function(){
20
20
 
21
- $(".conent_hide").hide();
21
+ $(".conent_hide").hide();
22
22
 
23
- $(".re").click(function(){
23
+ $(".re").click(function(){
24
24
 
25
- x=$(".re").text();
25
+ x=$(".re").text();
26
26
 
27
+ $(".conent_hide").slideToggle( function(){
27
28
 
29
+ if(x == "続きを読む"){
28
30
 
29
- $(".conent_hide").slideToggle( function(){
31
+ $(".re").text("続きを読む").css({color:"red"});
30
32
 
33
+ }
31
34
 
35
+ else{
32
36
 
33
- if(x == "続きを読む"){
37
+ $(".re").text("閉じる").css({color:"green"});
34
38
 
35
- $(".re").text("続きを読む").css({color:"red"});
39
+ }
36
40
 
37
- }
41
+ });
38
42
 
39
- else{
40
-
41
- $(".re").text("閉じる").css({color:"green"});
42
-
43
- }
44
-
45
- });
43
+ });
46
-
47
- });
48
44
 
49
45
  });
50
46
 
@@ -56,19 +52,15 @@
56
52
 
57
53
  <dl>
58
54
 
59
- <dt>AAA</dt>
55
+ <dt>AAA</dt>
60
56
 
61
- <dd>
57
+ <dd>
62
58
 
63
- <p>AAAのテキスト
59
+ <p>AAAのテキスト<div class="conent_hide">AAAのreadmoreテキスト</div></p>
64
60
 
65
- <div class="conent_hide">AAAのreadmoreテキスト</div>
61
+ <span class="re">続きを読む</span>
66
62
 
67
- </p>
68
-
69
- <span class="re">続きを読む</span>
70
-
71
- </dd>
63
+ </dd>
72
64
 
73
65
  </dl>
74
66
 
@@ -76,19 +68,15 @@
76
68
 
77
69
  <dl>
78
70
 
79
- <dt>BBB</dt>
71
+ <dt>BBB</dt>
80
72
 
81
- <dd>
73
+ <dd>
82
74
 
83
- <p>BBBのテキスト
75
+ <p>BBBのテキスト<div class="conent_hide">BBBのreadmoreテキスト</div></p>
84
76
 
85
- <div class="conent_hide">BBBのreadmoreテキスト</div>
77
+ <span class="re">続きを読む</span>
86
78
 
87
- </p>
88
-
89
- <span class="re">続きを読む</span>
90
-
91
- </dd>
79
+ </dd>
92
80
 
93
81
  </dl>
94
82