【发布时间】:2015-09-04 07:57:30
【问题描述】:
抱歉标题不好,不知道怎么解释这么短。
我有一个img,当我将它悬停时,它会显示一个带有一些文本的 div。
该 div 出现在您悬停的 img 中,当您悬停该 div 时...
你exualy离开img所以带有文本的div消失了。
所以我真正的问题是,我怎样才能让它仍然显示为块?
我已经尝试过了;
jQuery部分;
$("img#hover-for-text").on("mouseover", function(){
$(this).next().stop().fadeIn();
});
$("#text-hold").on("mouseover", function(){
$(this).next().stop().fadeIn();
});
$("img#hover-for-text").on("mouseleave", function(){
$(this).next().stop().fadeOut();
});
HTML 部分;
<div class="panel-body">
<div id="mycarousel" class="carousel slide" data-ride="carousel">
<img src="images/projects/<?=$data['picture']?>" class="img-responsive" id="hover-for-text">
<div class="carousel-caption">
<a style="color:black;"><?=$data['content']?></a>
</div>
</div>
</div>
CSS 部分;
.carousel-caption {
display: none;
}
【问题讨论】:
-
不能绑定
.slide上的事件吗? -
你对@JoelAlmeida有什么看法?
-
谢谢@JoelAlmeida 这工作:)
-
将添加为答案