Jquery 淡入我的图像库
我有一个图像库,我想添加淡入淡出效果,我如何在这段代码中做到这一点Jquery 淡入我的图像库,jquery,Jquery,我有一个图像库,我想添加淡入淡出效果,我如何在这段代码中做到这一点 $(document).ready(function() { $(".gallery div").mouseover(function(){ $(".gallery div").removeClass("current"); $(this).toggleClass("current"); }); }); 提前感谢使用淡入淡出功能 您可以根据需要进行fadeIn、fadeOut或fadeTo操作: $("p:
$(document).ready(function() {
$(".gallery div").mouseover(function(){
$(".gallery div").removeClass("current");
$(this).toggleClass("current");
});
});
提前感谢使用淡入淡出功能
您可以根据需要进行fadeIn、fadeOut或fadeTo操作:
$("p:first").click(function () {
$(this).fadeTo("slow", 0.33);
});
像这样的东西,在鼠标离开时消失,在悬停时消失
$(document).ready(function() {
$(".gallery div").mouseover(function(){
$(".gallery div").removeClass("current").fadeTo(500, 0.25);
$(this).toggleClass("current").stop().fadeIn(200);
});
});
您也可以通过以下方式执行此操作:
@茉莉花:你看到了什么结果?如果你能描述一下,也许我能帮上忙。非常感谢你,你的代码正在衰退,但并没有停止过渡中的衰退。$(document.ready(function(){$(“.gallery div”).mouseover(function(){$(“.gallery div”).removeClass(“current”);$(.gImg”).fadeTo(“slow”,0.33)$(this.toggleClass(“current”);;);此代码中,淡入.gImg图像,但“$(“.gImg”).stop().fadeTo(200);”无法停止fadeIn
$(document).ready(function() {
$(".gallery div").hover(function(){
$(this).addClass("current").stop().fadeIn(200);
}, function() {
$(this).removeClass("current").fadeTo(500, 0.25);
});
});
$(document).ready(function() {
$(".gallery div").hover(function(){
$(".gallery div").removeClass("current").fadeOut('fast');
$(this).toggleClass("current").fadeIn('fast');
});
});