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屋!
查看全文