【发布时间】:2015-06-23 23:27:44
【问题描述】:
我有以下代码在悬停图像时显示一些文本。但是当光标在 h1 标签上移动时会出现一些问题,当时它正在闪烁。为什么会这样?
jQuery(function($) {
$('.content1').mouseover(function() {
$('.content').show();
});
$('.content').mouseout(function() {
$('.content').hide();
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<img class="content1" src="http://upload.wikimedia.org/wikipedia/commons/thumb/6/61/HTML5_logo_and_wordmark.svg/2000px-HTML5_logo_and_wordmark.svg.png" style="width:100%;position:relative">
<div class="content" style="position: absolute; width: 100%; height: 100%; left: 0px; top: 0px; text-align: center; color: white; display: none; background: rgba(0, 0, 0, 0.901961);">
<h1 style="color:white">hiiiiiiiiiiiiiiiiiii</h1>
</div>
【问题讨论】:
-
...它发生在 Chrome 中,只是为了添加...(firefox 可以)
-
它是怎么闪烁的?哪个浏览器?在 ff 和 chrome 中很好
-
顺便说一句,我可以看到它。使用铬。虽然很微妙。
-
@nevermind 我也在使用 chrome..
-
mouseenter/mouseleave 问题?可能是由于
h1上的利润或其他原因?
标签: javascript jquery html