Html div类链接

时间:2017-10-16 21:05:51

标签: javascript jquery html css

确定我的div类我希望示例文本链接到另一个页面。我该怎么办?而且我想要视频背景点击另一页。有什么帮助吗?

 <div class="container">
        <video poster="Sample.jpg" autoplay="true" loop>
            <source src="Burning.mp4" type="video/mp4">
            <source src="Burning.webm" type="video/webm">
            </video>
            <div class="text">Example</div>
            </div>

1 个答案:

答案 0 :(得分:0)

根据你的评论,我最好的猜测是你想要这个:

<div class="container" >
    <video poster="Sample.jpg" autoplay="true" loop id="video">
        <source src="Burning.mp4" type="video/mp4">
        <source src="Burning.webm" type="video/webm">
    </video>
    <div class="text"><a href="page2">Example</a></div>
</div>
<script>
document.getElementById("video").addEventListener("click", redirect);

function redirect(){
    window.location.replace("page1")
}
</script>