js 播放视频文件 使用embed标签
1.jquery方法 加载的文件是.swf格式
首先加载jquery 文件
首先是JS文件
<script type="text/javascript">
$(function(){
$('#play').on("click" , function(){
$('.theme-popover-mask').fadeIn(100);
$('.theme-popover').slideDown();
$('.theme-popover .mv').append('<embed src="xiangcloud.swf" quality="high" wmode="opaque" width="100%" height="366px" align="middle" allowscriptaccess="never" allowfullscreen="true" type="application/x-shockwave-flash" id="viedo"></embed>');
})
/*close button*/
$('.close').on("click" , function (){
$('.theme-popover-mask').fadeOut(100);
$('.theme-popover').slideUp();
$('#viedo').remove();
});
});
</script>
CSS样式
<style type="text/css">
.theme-popover{
z-index:9999;
position:fixed;
top:30%;
left:50%;
width:650px;
margin:-115px 0 0 -330px;
border:solid 2px #666;
display:none;
box-shadow: 0 0 10px #666;
}
.theme-poptit a{
position: absolute;
right: -8px;
top: -10px;
color: rgb(0, 0, 0);
font-size: 20px;
background: rgb(255, 255, 255);
border-radius: 15px;
width: 20px;
height: 20px;
text-align: center;
line-height: 20px;
text-decoration:none;
}
.theme-popover-mask{
z-index: 9998;
position:fixed;
top:0;
left:0;
width:100%;
height:100%;
background:#000;
opacity:0.4;
filter:alpha(opacity=40);
display:none;
}
</style>
HTML结构
<p><a href="javascript:;" id="play">点击播放</a></p>
<div class="theme-popover">
<div class="theme-poptit">
<a href="javascript:;" title="关闭" class="close">×</a>
</div>
<div class="mv"></div>
</div>
<div class="theme-popover-mask"></div>
问题1 mp4文件无法加载

浙公网安备 33010602011771号