简体   繁体   English

鼠标移动视频

[英]Video on mousemove

I'm having problems while trying to play a video as long as mouse moves. 只要鼠标移动,尝试播放视频时就会遇到问题。 I want it's time to follow mouse, as if the mouse was the time handler. 我希望是时候跟随鼠标了,就像鼠标是时间处理程序一样。 I have this code. 我有这个代码。 It works fine on Internet Explorer but on Chrome or Mozi time is not fluid, as it has something to do with refreshing times. 它在Internet Explorer上可以正常工作,但在Chrome或Mozi上,时间并不流畅,因为它与刷新时间有关。 Video plays with difficult. 视频播放困难。

<script type="text/javascript">
var mouseX;

    $(document).mousemove( function moveFunc(e) {
    mouseX = e.clientX;
    var timV = $(".video").get(0).duration;
    var valV = (timV*mouseX/$(window).width());
    $(".video").get(0).currentTime = valV;

});
</script>

Could you help me? 你可以帮帮我吗?

Firefox and Chrome stopped firing mousemove events for every mouse position update on the window and document in an attempt to make pages more responsive. Firefox和Chrome停止触发窗口和文档上每个鼠标位置更新的mousemove事件,以提高页面的响应速度。 You can fix it by binding your event to something more specific like the video element itself or any wrapper element. 您可以通过将事件绑定到更具体的内容(例如video元素本身或任何包装元素)来解决此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM