鼠标悬停播放音频() [英] Play Audio on mouse Hover()
本文介绍了鼠标悬停播放音频()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在jquery中定义一个没有控件的音频
并在鼠标悬停()上播放它?
任何帮助表示赞赏!
how to define an audio with no controls in jquery
and play it on mouse hover()?
any help appreciated!
推荐答案
HTML5对您来说是否可行?然后使用元素< audio>
:
http://en.wikipedia.org/wiki/HTML5_Audio [ ^ ],
http: //www.w3.org/TR/html5/embedded-content-0.html#the-audio-element [ ^ ],
http://www.w3.org/TR/webaudio/ [ ^ ]。
此元素的方法为play()
您可以在hover处理程序中调用它: http://api.jquery.com/hover/ [ ^ ]。
-SA
Is HTML5 a viable option for you? Then use the element<audio>
:
http://en.wikipedia.org/wiki/HTML5_Audio[^],
http://www.w3.org/TR/html5/embedded-content-0.html#the-audio-element[^],
http://www.w3.org/TR/webaudio/[^].
This element has the methodplay()
which you can call in your handler of "hover": http://api.jquery.com/hover/[^].
—SA
将第二个函数(mouseout)留空,以便只有在将鼠标输入a标签时播放音频
leave second function(mouseout) blank so audio plays only when entering mouse into "a" tag
( a)。hover(function(){
var audio =
("a").hover(function(){ var audio =
这篇关于鼠标悬停播放音频()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文