質問編集履歴
2
コードの修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -13,22 +13,52 @@
|
|
13
13
|
|
14
14
|
```
|
15
15
|
html
|
16
|
+
<div class="audio_player" data-mp3="<?=$mp3file[$i]?>" data-playerid="<?=$i?>">
|
17
|
+
</div>
|
18
|
+
<div class="jp_container_<?=$i?>">
|
19
|
+
<div class="jp-play"></div>
|
20
|
+
<div class="jp-pause"></div>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<!--
|
16
|
-
<div class="audio_player"></div>
|
24
|
+
<div class="audio_player"></div>
|
17
25
|
<div class="jp_container">
|
18
26
|
<div class="jp-play"></div>
|
19
27
|
<div class="jp-pause"></div>
|
20
28
|
</div>
|
21
|
-
|
22
|
-
<div class="audio_player"></div>
|
29
|
+
<div class="audio_player"></div>
|
23
30
|
<div class="jp_container">
|
24
31
|
<div class="jp-play"></div>
|
25
32
|
<div class="jp-pause"></div>
|
26
33
|
</div>
|
34
|
+
-->
|
27
35
|
以後必要なだけ繰り返し
|
28
36
|
```
|
29
37
|
|
30
38
|
```
|
31
39
|
javascript
|
40
|
+
$('.audio_player').each( function() {
|
41
|
+
var player = $(this);
|
42
|
+
var _id = player.data('playerid');
|
43
|
+
var _mp3 = player.data('mp3');
|
44
|
+
|
45
|
+
player.jPlayer({
|
46
|
+
ready: function(){
|
47
|
+
player.jPlayer('setMedia', {
|
48
|
+
mp3: "./mp3/" + _mp3
|
49
|
+
});
|
50
|
+
},
|
51
|
+
play: function() {
|
52
|
+
player.jPlayer("pauseOthers");
|
53
|
+
},
|
54
|
+
swfPath: './',
|
55
|
+
wmode: 'window',
|
56
|
+
cssSelectorAncestor: ".jp_container_" + _id,
|
57
|
+
keyEnabled: true
|
58
|
+
});
|
59
|
+
});
|
60
|
+
|
61
|
+
/*
|
32
62
|
$('.audio_player').jPlayer({
|
33
63
|
ready: function(){
|
34
64
|
$(this).jPlayer('setMedia', {
|
@@ -43,6 +73,7 @@
|
|
43
73
|
cssSelectorAncestor: ".jp_container",
|
44
74
|
keyEnabled: true
|
45
75
|
});
|
76
|
+
*/
|
46
77
|
```
|
47
78
|
```
|
48
79
|
css
|
1
コードの追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -6,4 +6,62 @@
|
|
6
6
|
上記ページを参考に複数を配置したいのですが、条件によって配置する数が異なり、動的に配置したいため、idではなくclassで配置できるようにしたい。
|
7
7
|
そもそも実現が可能なのか
|
8
8
|
|
9
|
-
情報が少ないとは思いますが、なにか参考になるドキュメントなどあれば勉強させてください。
|
9
|
+
情報が少ないとは思いますが、なにか参考になるドキュメントなどあれば勉強させてください。
|
10
|
+
|
11
|
+
追記
|
12
|
+
1つ目のみ記載した場合問題なく再生出来ますが、2つ目を追加すると再生できない状態です。
|
13
|
+
|
14
|
+
```
|
15
|
+
html
|
16
|
+
<div class="audio_player"></div><!--1つ目-->
|
17
|
+
<div class="jp_container">
|
18
|
+
<div class="jp-play"></div>
|
19
|
+
<div class="jp-pause"></div>
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<div class="audio_player"></div><!--2つ目-->
|
23
|
+
<div class="jp_container">
|
24
|
+
<div class="jp-play"></div>
|
25
|
+
<div class="jp-pause"></div>
|
26
|
+
</div>
|
27
|
+
以後必要なだけ繰り返し
|
28
|
+
```
|
29
|
+
|
30
|
+
```
|
31
|
+
javascript
|
32
|
+
$('.audio_player').jPlayer({
|
33
|
+
ready: function(){
|
34
|
+
$(this).jPlayer('setMedia', {
|
35
|
+
mp3: "./mp3/01.mp3"
|
36
|
+
});
|
37
|
+
},
|
38
|
+
play: function() {
|
39
|
+
$(this).jPlayer("pauseOthers");
|
40
|
+
},
|
41
|
+
swfPath: './',
|
42
|
+
wmode: 'window',
|
43
|
+
cssSelectorAncestor: ".jp_container",
|
44
|
+
keyEnabled: true
|
45
|
+
});
|
46
|
+
```
|
47
|
+
```
|
48
|
+
css
|
49
|
+
.jp-play{
|
50
|
+
position: absolute;
|
51
|
+
left: 5px;
|
52
|
+
width: 15px;
|
53
|
+
height: 15px;
|
54
|
+
background: url('../jplayer/icon.png') center top no-repeat;
|
55
|
+
cursor: pointer;
|
56
|
+
}
|
57
|
+
|
58
|
+
.jp-pause{
|
59
|
+
position: absolute;
|
60
|
+
left: 5px;
|
61
|
+
width: 15px;
|
62
|
+
height: 15px;
|
63
|
+
background: url('../jplayer/icon.png') center bottom no-repeat;
|
64
|
+
cursor: pointer;
|
65
|
+
display: none;
|
66
|
+
}
|
67
|
+
```
|