我同意rajveer家蠶,試試這個代碼
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<style type="text/css">audio {display: none;}</style>
</head>
<body>
<ul id="nav-two" class="nav">
<li>
<a href="#">Home</a>
<audio id="sound" controls preload="auto"><source src="http://soundbible.com/mp3/MP5_SMG-GunGuru-703432894.mp3" controls></source></audio>
</li>
<li><a href="#">About</a></li>
<li><a href="#">Clients</a></li>
<li><a href="#">Contact Us</a></li>
</ul>
<script>
$("#nav-two a")
.each(function(i) {
if (i != 0) {
$("#sound")
.clone()
.attr("id", "sound" + i)
.appendTo($(this).parent());
}
$(this).data("beep", i);
})
.mouseenter(function() {
$("#sound" + $(this).data("beep"))[0].play();
});
$("#sound").attr("id", "sound0");
</script>
</body>
你可以檢查這個答案的澄清細節 - http://stackoverflow.com/questions/16348489/is-there-a-css-hack-for-safari-onl y-not-chrome –
您可以通過php或Javascript檢查瀏覽器,然後如果它是Safari,請爲該元素添加一個類併爲其添加額外的樣式。 – Mossen
Safari不應該給這麼多問題。您是否正在測試Safari for Windows?這是一個多年來一直未得到支持的死瀏覽器,並且存在安全漏洞。你應該鼓勵人們停止使用它。 – Quentin