如何使切换过渡看起来更柔和?我正在“切换”2 个 div:
$(document).ready(function(){
var tweet = $("ul.tweets li");
tweet.hover(function(){
$(this).find('.a').toggle()
.end().find('.b').toggle();
});
});
这是fiddle
最佳答案
您可以使用.fadeToggle()
.
编辑:如果您绝对定位.b
并相对定位li
,则只需切换.b
>:
工作演示: http://jsfiddle.net/kpNY4/8/
tweet.hover(function () {
$(".b", this).fadeToggle();
});
CSS:
li { position: relative; }
.b {
display: none;
background: #EEEEEE;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
关于jquery - 如何淡出切换以使过渡看起来更柔和,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8157155/