2011-12-29 25 views
0

我试图做一个简单的声卡和目前的格式在IE9工作正常,但在Chrome中是有奇怪的箱子,我相信通过剧本来演的声音产生。我无法弄清楚如何摆脱它们。 enter image description hereHTML音板有幽灵箱在Chrome

这里是我的代码:

<head> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
    <title>Soundboard</title> 
    <link rel="stylesheet" type="text/css" href="style.css"> 


</head> 
<body> 
    <div id="doc"> 
     <h1>Soundboard</h1> 
     <!-- JS here to prevent 'flash' of all the default audio players --> 
     <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> 
     <script type="text/javascript" charset="utf-8"> 
      $(function() { 
       $("audio").removeAttr("controls").each(function(i, audioElement) { 
        var audio = $(this); 
        var that = this; //closure to keep reference to current audio tag 
        $("#doc").append($('<button>'+audio.attr("title")+'</button>').click(function() { 
         that.play(); 
        })); 
       }); 
      }); 
     </script> 
           <audio src="audio/emintro.mp3" controls autobuffer="true" title="Murray!"></audio> 
           <audio src="audio/emitheme.mp3" controls autobuffer="true" title="Intro"></audio> 

    </div> 

</body> 
</html> 

回答

1

在我看来就像Chrome正在努力显示播放/暂停等按钮 - 因为你已经在你的controls参数定义。这只是被处理不同。 <audio>标签是新的,并且不受支持。

我只是隐藏音频元素和创建自己的按钮播放它们,你定义的方式和控制UI。

+0

再次营救,谢谢。 – Nick 2011-12-30 01:33:39