HTML5的音频播放器 - jQuery的切换点击播放/暂停? [英] html5 audio player - jquery toggle click play/pause?
本文介绍了HTML5的音频播放器 - jQuery的切换点击播放/暂停?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不知道我做错了什么?
i wonder what i'm doing wrong?
$('.player_audio').click(function() {
if ($('.player_audio').paused == false) {
$('.player_audio').pause();
alert('music paused');
} else {
$('.player_audio').play();
alert('music playing');
}
});
我似乎无法启动音轨,如果我打出了player_audio标签。
i can't seem to start the audio track if i hit the "player_audio" tag.
<div class='thumb audio'><audio class='player_audio' src='$path/$value'></audio></div>
任何知道我做错了,或我必须做的就是它的工作是什么?
any idea what i'm doing wrong or what i have to do to get it working?
推荐答案
好吧,我不是100%肯定,但我不认为jQuery的扩展/解析这些功能和属性( .paused
, .pause()
, .play()
)。
Well, I'm not 100% sure, but I don't think jQuery extends/parses those functions and attributes (.paused
, .pause()
, .play()
).
试图访问这些在DOM元素,像
try to access those over the DOM element, like
$('.player_audio').click(function() {
if (this.paused == false) {
this.pause();
alert('music paused');
} else {
this.play();
alert('music playing');
}
});
这篇关于HTML5的音频播放器 - jQuery的切换点击播放/暂停?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文