我有一个图片库,我想添加淡入淡出效果,我该如何在此代码中做到这一点?
$(document).ready(function() {
$(".gallery div").mouseover(function(){
$(".gallery div").removeClass("current");
$(this).toggleClass("current");
});
}); 提前感谢
发布于 2010-01-28 21:51:37
$(document).ready(function() {
$(".gallery div").hover(function(){
$(".gallery div").removeClass("current").fadeOut('fast');
$(this).toggleClass("current").fadeIn('fast');
});
}); 发布于 2010-01-28 21:50:24
使用fade effect。
您可以根据需要执行fadeIn、fadeOut或fadeTo:
$("p:first").click(function () {
$(this).fadeTo("slow", 0.33);
});发布于 2010-01-28 21:51:13
像这样的东西,鼠标淡出,悬停淡出?
$(document).ready(function() {
$(".gallery div").mouseover(function(){
$(".gallery div").removeClass("current").fadeTo(500, 0.25);
$(this).toggleClass("current").stop().fadeIn(200);
});
});您也可以通过hover() function执行此操作
$(document).ready(function() {
$(".gallery div").hover(function(){
$(this).addClass("current").stop().fadeIn(200);
}, function() {
$(this).removeClass("current").fadeTo(500, 0.25);
});
});https://stackoverflow.com/questions/2154882
复制相似问题