单击按钮1时如何播放音频,单击按钮2或3时暂停/停止?
<a href="#" class="button1">Button 1</a>
<a href="#" class="button2">Button 2</a>
<a href="#" class="button3">Button 3</a>
<audio controls autoplay loop>
<source src="<?php bloginfo('template_directory'); ?>/audio/audio1.ogg" type="audio/ogg">
<source src="<?php bloginfo('template_directory'); ?>/audio/audio1.mp3" type="audio/mpeg">
Your browser does not support the audio tag.
</audio>
答案 0 :(得分:0)
$(".button1").click(function() {
$("audio")[0].play();
});
$(".button2").click(function() {
$("audio")[0].pause();
});
答案 1 :(得分:0)
$(".button1").click(function(){
$('audio')[0].play();
})
$(".button2").click(function(){
$('audio')[0].pause();
})