jQuery:悬停播放视频
寻找比这更好的解决方案:jQuery:悬停播放视频,jquery,html5-video,Jquery,Html5 Video,寻找比这更好的解决方案: $(".video-post").hover(function () { $(this).find("video").get(0).play(); }, function () { $(this).find("video").get(0).pause(); }); ->它可以工作,但会导致chrome错误: DomeException:play()请求被对pause()的调用中断 有一些关于这方面的文章,但似乎找不到任何简单的答案 试试:
$(".video-post").hover(function () {
$(this).find("video").get(0).play();
}, function () {
$(this).find("video").get(0).pause();
});
->它可以工作,但会导致chrome错误:
DomeException:play()请求被对pause()的调用中断
有一些关于这方面的文章,但似乎找不到任何简单的答案 试试:
$(document).ready(function () {
$(".video-post").hover(function () {
$(this).find("video")[0].play();
}, function () {
var el = $(this).find("video")[0];
el.pause();
el.currentTime = 0;
});
});