jquery - 在鼠标悬停时在视频上显示自定义按钮

标签 jquery html css video

我有一个介绍视频,我想将其显示为网站的第一页,现在必须有一个按钮可以将用户带到主要内容。当用户将鼠标悬停在视频上时,我想将它放在中心的视频上。

这是我试过的:

<html>
<head>
<style>

#text{
    z-index:9999;
    position: absolute;
    top:100px;
    left:100px;
}

#video{
position:relative;
margin:0 auto;
left:0px;
right:0px;
}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js">
</script>
</head>
<body>
    <div id="text">
        THis is a test text
    </div>
    <div id="video">
        <embed src="videos/abc.mp4" height="600" width="800">
    </div>

<script>
    $(document).ready(function(){
        $("#video").mouseenter(function(){

        $("#text").show();

        });

        $("#video").mouseleave(function(){

        $("#text").hide();

        });
    });
</script>
</body>
</html>

最佳答案

你根本不需要javascript:http://jsbin.com/fomiseze/1/

.close {
    display: none;
}

#video:hover .close {
    display: block;
}

关于jquery - 在鼠标悬停时在视频上显示自定义按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23672321/

相关文章:

javascript - 将for循环附加到html中的div

javascript - 删除新闻页面上的 "turn off adblock"广告包装

IE 7 中回发的 ASP.NET CSS 不起作用

javascript - 数据表所有页面总数不起作用,只起作用当前页面

javascript - 使用Jquery刷新除单个图像之外的所有页面

javascript - jQuery Fullcalendar 不在 IE 中呈现事件

php - PHP 和 HTML 中引号的语法问题

javascript - 将JSON数据放入隐藏的html表单输入?

javascript - 多重计算无法正常工作

html - 图片的 CSS 宽度和高度问题