手机端代码:
<div id="vid" style="100%; position:relative;"> <video id="video" style="100%;" src="http://www.test.com/video/jsbd.mp4" poster="http://www.test.com/video/jsbd_bj.jpg" controls="">"你的浏览器不支持video标签"<ideo></ideo></video> </div> <p>成立啦</p>
pc端代码:
<div id="vid" style="640px; height:360px; margin:0 auto; position:relative; cursor:pointer;"> <video controls="" height="360" id="video" src="http://www.test.net/video/jsbd.mp4" width="640"> "你的浏览器不支持video标签"<ideo> </ideo></video> </div> <script> function video(){ var oVid = document.getElementById("vid"); var oVideo = document.getElementById("video"); var oVideo_bf = document.getElementById("video_bf"); oVid.onmouseover = function(){if(oVideo.paused){oVideo_bf.style.display = 'block';}} oVid.onmouseout = function(){oVideo_bf.style.display = 'none';} oVid.onclick = function(){ oVideo.paused?oVideo.play():oVideo.pause(); } } video(); </script>