Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery ui 打开模态jquery对话框时自动播放音频?_Jquery Ui_Audio_Modal Dialog_Media Player_Dreamweaver - Fatal编程技术网

Jquery ui 打开模态jquery对话框时自动播放音频?

Jquery ui 打开模态jquery对话框时自动播放音频?,jquery-ui,audio,modal-dialog,media-player,dreamweaver,Jquery Ui,Audio,Modal Dialog,Media Player,Dreamweaver,我已经设置了一个html,其中:当您单击日志按钮时,会打开一个jquery模式对话框,其中包含更多信息和日志。一切都很好。但是我想在对话框打开时播放音频 到目前为止,我有11个对话框,每个对话框有11个独立的音频,但是当音频设置为“自动播放”时,页面上的所有音频都会在页面加载后立即开始播放 如何使每个日志按钮的音频仅在单击对话框打开按钮时开始播放 以下是其中一个对话框的代码: 我曾经遇到过一个类似的问题:也许这是我感兴趣的地方。谢谢Jakob,你发给我的链接,以及它建议的修复方法,只需稍加编辑

我已经设置了一个html,其中:当您单击日志按钮时,会打开一个jquery模式对话框,其中包含更多信息和日志。一切都很好。但是我想在对话框打开时播放音频

到目前为止,我有11个对话框,每个对话框有11个独立的音频,但是当音频设置为“自动播放”时,页面上的所有音频都会在页面加载后立即开始播放

如何使每个日志按钮的音频仅在单击对话框打开按钮时开始播放

以下是其中一个对话框的代码:


我曾经遇到过一个类似的问题:也许这是我感兴趣的地方。谢谢Jakob,你发给我的链接,以及它建议的修复方法,只需稍加编辑就可以完美地工作。真的很感激!
<div id="dialog-4" title="The brushwood platform"><p><span style=""><em>Kevin and Izzy worked on excavating the brushwood platform.</em></span></p>

<table width="688" height="390" align="center" class="dialog_form">
<tr>
  <td width="320" height="189"><figure><img src="images/megaphone.png" width="250" height="320" border="0" alt="Illustration of Izzy and Kevin filler"/><figcaption>Illustration of Kevin and Izzy</figcaption></figure></td>
  <th width="13">&nbsp;</th>
    <td width="631"><p>This is an area that had been created by laying down brushwood and then covering with worked timbers.</p></td>
</tr>
<tr>
  <td height="142" style="text-align: center"><audio id="audio4" title="Spoken Journal" preload="auto" controls autoplay loop >
    <source src="../Kizzy (brushwood, reed peat).mp3" type="audio/mpeg">
    Your browser does not support the audio element. </audio>
  </td>
  <td>&nbsp;</td>
    <td><p>The platform is on the lake edge and was likely used for stability on the boggy ground. Evidence of flint knapping has been found in and around the platform.</p></td>
</tr>
<tr>
  <th height="251"><figure><img src="images/imgp2925-copy.jpg" width="300" height="190" alt="Brushwood"/><figcaption>Part of the brushwood platform excavated in 2015 at Star Carr.</figcaption></figure></th>
  <th>&nbsp;</th>
</tr>
</div>
    <button id="opener-4"></button>

</article>
     $(function() {
        $( "#dialog-4" ).dialog({
           autoOpen: false, 
           modal: true,
           resizable: false,
           draggable: false,
           width: 950,
           height: 600,
           buttons: {
              OK: function() {$(this).dialog("close");}
           },
        });
        $( "#opener-4" ).click(function() {
           $( "#dialog-4" ).dialog( "open" );
        }); 
     });