回答編集履歴
3
補足の追加。
answer
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
こんな感じでしょうか。
|
1
|
+
こんな感じでしょうか。
|
2
|
+
**追記:**テストしました。さっきのは動かない・・・ ので修正して[サンプル](https://jsfiddle.net/a1v5ey6p/)で動作を確認出来ます。
|
2
3
|
|
3
4
|
```JavaScript
|
4
5
|
jQuery( '.show_box:gt(2)' ).addClass( 'show_box_hide' ).hide();
|
@@ -22,5 +23,8 @@
|
|
22
23
|
<p>記事はありません</p>
|
23
24
|
<?php endif; ?>
|
24
25
|
```**動くサンプル:**[https://jsfiddle.net/a1v5ey6p/](https://jsfiddle.net/a1v5ey6p/)
|
26
|
+
|
27
|
+
---
|
28
|
+
|
25
29
|
【jQueryでa番目からb番目まで範囲指定セレクタ - Web学び】
|
26
30
|
[http://fukuyama.co/ltgt](http://fukuyama.co/ltgt)
|
2
ミスがあったため修正。
answer
CHANGED
@@ -3,9 +3,9 @@
|
|
3
3
|
```JavaScript
|
4
4
|
jQuery( '.show_box:gt(2)' ).addClass( 'show_box_hide' ).hide();
|
5
5
|
jQuery( '.more' ).on( 'click', function() {
|
6
|
-
|
6
|
+
jQuery( '.show_box_hide:lt(3)').removeClass( 'show_box_hide' ).slideDown( 'fast' );
|
7
|
-
|
7
|
+
if ( jQuery( '.show_box.show_box_hide' ).length === 0 ) { jQuery( '.more' ).hide(); }
|
8
|
-
} );
|
8
|
+
} );
|
9
9
|
```
|
10
10
|
```PHP
|
11
11
|
<?php endwhile; /* ボタンをループから外す */ ?>
|
@@ -21,6 +21,6 @@
|
|
21
21
|
<?php else: ?>
|
22
22
|
<p>記事はありません</p>
|
23
23
|
<?php endif; ?>
|
24
|
-
```
|
24
|
+
```**動くサンプル:**[https://jsfiddle.net/a1v5ey6p/](https://jsfiddle.net/a1v5ey6p/)
|
25
25
|
【jQueryでa番目からb番目まで範囲指定セレクタ - Web学び】
|
26
26
|
[http://fukuyama.co/ltgt](http://fukuyama.co/ltgt)
|
1
ミスがあったため修正。
answer
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
```JavaScript
|
4
4
|
jQuery( '.show_box:gt(2)' ).addClass( 'show_box_hide' ).hide();
|
5
5
|
jQuery( '.more' ).on( 'click', function() {
|
6
|
-
jQuery( '.
|
6
|
+
jQuery( '.show_box.show_box_hide:gt(2)').removeClass( 'show_box_hide' ).slideDown( 'fast' );
|
7
|
-
if ( jQuery( '.
|
7
|
+
if ( jQuery( '.show_box.show_box_hide' ).length === 0 ) { jQuery( '.more' ).hide(); }
|
8
8
|
} ); // 未テスト
|
9
9
|
```
|
10
10
|
```PHP
|