Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ms-access/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 淡入我的图像库_Jquery - Fatal编程技术网

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');
});
 });