Jquery 在图像上淡入文本
有两件事似乎不合适Jquery 在图像上淡入文本,jquery,css,Jquery,Css,有两件事似乎不合适 我希望能够悬停较大的DIV,以便将较小的DIV带入视图 目前,它只在您将鼠标悬停在较小的DIV上时工作。 2.当我停止悬停时,较小的DIV不会消失 <div class="one"> <div class="two"></div> </div> <div class="one"> <div class="two"></div> </div> 这是因为您正在选择
<div class="one">
<div class="two"></div>
</div>
<div class="one">
<div class="two"></div>
</div>
这是因为您正在选择较小的div标记
$(function() {
$(".two").hide();
$(".one").hover(function() {
$('.two', this).fadeIn(200);
}, function() {
$('.two', this).fadeOut(200);
});
});
.one
,然后在的上下文中更改较小的div,.two
,每当鼠标悬停.one
。当从可见淡入不可见时,大部分时间都可以使用fadeIn/Out,只需在CSS中将元素设置为display:none
$(function(){
$('.one').on({
mouseenter: function() {
$(".two", this).fadeIn(200);
},
mouseleave: function() {
$(".two", this).fadeOut(200);
}
});
});
很抱歉,这篇文章格式不正确:)
$(function() {
$(".two").hide();
$(".one").hover(function() {
$('.two', this).fadeIn(200);
}, function() {
$('.two', this).fadeOut(200);
});
});
$(function(){
$('.one').on({
mouseenter: function() {
$(".two", this).fadeIn(200);
},
mouseleave: function() {
$(".two", this).fadeOut(200);
}
});
});
$(".one").on('mouseenter mouseleave',function ( e ) {
var fade = e.type=='mouseenter'?
$('.two', this).stop().fadeTo(200, 1):
$('.two', this).stop().fadeTo(200, 0);
});