弹框播放腾讯视频(Iframe)

2022-05-06 14:02:18 浏览数 (2)

代码语言:javascript复制
<img src="{*Pic}" alt="" onclick="palyabout('v1','iframe的src链接')">
代码语言:javascript复制
<style> 
.videoss {
    width: 100%;
    margin: 0 auto;
    padding-top: 5%;
}
.videomains {
    position: fixed;
    top: 10rem;
    left: 16%;
    z-index: 10;
    display: none;
}
.XXX {
    width: 100%;
    height: 100%;
    background: black;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9;
    opacity: 0.1;
    display: none;
}
.iframe {
    width:300%;
    height:400px;
}
</style>
代码语言:javascript复制
<script src="js/layer/layer.js"></script> 
<script> 
function palyabout(data,paths) {
    if(paths=="") {
    layer.msg("暂无视频!");
    return false;
}
$("#Video1").attr("src",paths);
    $(".txp_tipbar").attr("style","display:none");
    if (data == "v1") {
    $(".videomains").css("display", "block");
    $(".XXX").css("display", "block");
    $("#Video1").css("display", "block");
    $("#Video1")[0].play()
}
} $(".XXX").click(function () {
    document.getElementById("Video1").pause();
    $(".videomains").css("display", "none");
    $(".XXX").css("display", "none");
    $("#Video1").css("display", "none");
}
);
    function closevideo() {
    $(".videomains").css("display", "none");
    $(".XXX").css("display", "none");
    $("#Video1").css("display", "none");
}
</script>
代码语言:javascript复制
<div class="XXX" onclick="closevideo()"></div>
<div class="videomains">
    <iframe frameborder="0" src="" allowFullScreen="true" class="iframe" id="Video1" ></iframe>
    <!-- <video  src="" controls class="videoss" id="Video1" />-->//设置本地视频src路径 播放
</div>

0 人点赞