0
我模拟“咔嗒”的声音在每个锚标记,并且我正在使用下面的代码在移动网站上提交按钮点击:模拟iPad的咔嗒声
<audio id="mySoundClip" style=" display:none; visibility:hidden;">
<source src="@Url.Content("~/Content/audio/Click.ogg")" type="audio/ogg">
<source src="@Url.Content("~/Content/audio/Tock.mp3")" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<script type="text/javascript">
var homeURL = '@Url.Action("Index", "Home")';
var audio = $("#mySoundClip")[0];
$("[href]").click(function() {
//alert("a clicked");
audio.play();
});
$(":submit").click(function() {
//alert("submit button clicked");
audio.play();
});
</script>
它按预期工作,但声音文件实际播放时单击定位标记/提交按钮时会稍微延迟。有没有办法播放声音文件比实际播放时快一点,所以它看起来像是一个本地点击?
感谢您的快速回复!它可以工作,但仍然没有尽快播放声音。实际点击和声音之间仍然存在滞后。 – WhatsInAName 2013-04-22 21:09:49