2013-12-16 227 views
1

我有一個mediaelement js的小問題。 當鼠標沒有移動時,我的播放器不會隱藏鼠標光標。Mediaelement JS - 當鼠標不移動時隱藏鼠標光標

<script src="build/jquery.js"></script> 
<script src="build/mediaelement-and-player.js"></script> 

<link rel="stylesheet" href="build/mediaelementplayer.css" /> 

<video width="850" height="350" id="player2" controls="controls"> 
<source src="http://127.0.0.1/publics/ip4.mp4" type="video/mp4"> 
<track kind="subtitles" src="iron.man.3.2013.720p.bluray.dts.x264-publichd.srt.txt"  srclang="en" /> 

<script> 
$('audio,video').mediaelementplayer(); 
</script> 

回答

0

我知道這是一個老話題,但它可以幫助別人......

var mHidden = false; 
var j; 

$(document).mousemove(function() { 
    if (!mHidden) { 
     mHidden = false; 
     clearTimeout(j); 
     $('#player2').css({cursor: 'default'}); 
     j = setTimeout(hide, 1000); 
    } 
}); 

function hide() { 
     $('#player2').css({cursor: 'none'}); 
     mHidden = true; 
     setTimeout(function() { 
      mHidden = false; 
     }, 500); 
}