jqueryanimate只运行一次
我正试图使所有属于.to be hidden css类的div消失,并使id=“feat hover”的div在我悬停在div id=“mission”上时完全可见 这是我的密码:jqueryanimate只运行一次,jquery,css,hover,jquery-animate,Jquery,Css,Hover,Jquery Animate,我正试图使所有属于.to be hidden css类的div消失,并使id=“feat hover”的div在我悬停在div id=“mission”上时完全可见 这是我的密码: $(function() { $("#mission").hover(function () { $(".to-be-hidden").stop().animate({opacity: 0.5}, "slow");
$(function() {
$("#mission").hover(function () {
$(".to-be-hidden").stop().animate({opacity: 0.5}, "slow");
$('#feat-hover').stop().animate({'opacity': '1.0'}, "slow");
},
function () {
$(".to-be-hidden").stop().animate({opacity: 1.0}, "slow");
$('#feat-hover').stop().animate({'opacity': '0'}, "slow");
});
});
这是我的HTML:
我用希望淡出的文字块替换了这些文字
<div id="featured" class="grid col-940">
<div id="left-landing-container" class="left-cont" style="">
<div class="to-be-hidden">
<div class="left-div">want this to fade</div>
<div class="left-div">want this to fade</div>
</div>
<div class="to-be-hidden">
<div class="left-div">want this to fade</div>
<div class="left-div">want this to fade</div>
</div>
</div>
<div id="mission" class="keep-visible">
<div class="left-div" style="padding: 1px 0px 1px 6px; width: 97%;"">Mission Statement</div>
</div>
</div><!-- end of #left-landing-container -->
想让它褪色吗
想让它褪色吗
想让它褪色吗
想让它褪色吗
试试这个,它会解决你的问题
$(function() {
$("#mission").hover(function () {
$(".to-be-hidden").each(function( index ) {
$(this).stop().animate({opacity: 0.5}, "slow");
$('#feat-hover').stop().animate({'opacity': '1.0'}, "slow");
});},
function () {
$(".to-be-hidden").each(function( index ) {
$(this).stop().animate({opacity: 1.0}, "slow");
$('#feat-hover').stop().animate({'opacity': '0'}, "slow");
});
});
});
有没有可能对这个问题感到困惑?你的HTML是什么样子的?将它添加到您的问题中。至少在猜测标记的情况下,这里似乎不是一个问题。对我来说很有用:此代码中没有问题,,您可能对页面上的其他代码有问题。很抱歉,您能简要说明问题是什么,以及您的解决方案是如何解决的吗?