Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/72.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 FadeIn效果_Jquery_Fadein - Fatal编程技术网

站点背景图像的JQuery FadeIn效果

站点背景图像的JQuery FadeIn效果,jquery,fadein,Jquery,Fadein,我正在尝试使fadeIn()效果对一系列漫游图像起作用。我采用了另一个答案中的一些代码,效果很好,但不幸的是,我无法得到它的衰减效果。我尝试将fadeIn()添加到$(“尝试 $.fn.smartBackgroundImage = function(url){ var t = this; //create an img so the browser will download the image: $('<img />') .att

我正在尝试使fadeIn()效果对一系列漫游图像起作用。我采用了另一个答案中的一些代码,效果很好,但不幸的是,我无法得到它的衰减效果。我尝试将fadeIn()添加到
$(“尝试

$.fn.smartBackgroundImage = function(url){
      var t = this;
      //create an img so the browser will download the image:
      $('<img />')
        .attr('src', url)
        .load(function(){ //attach onload to set background-image
            t.each(function(){ 
              $(this).css('backgroundImage', 'url('+url+')' );
           });
        });
       return this;
     }

    //10 second Interval
    window.setInterval(rotate, 10000);
    var counter = 0;
    function rotate() { 
        //Rotage through images 0 - 4
        $('html').smartBackgroundImage('assets/background'+counter+'.jpg');
        counter == 3? counter = 0 : counter++;
    }
$("html").smartBackgroundImage("assets/background" + counter + ",jpg").fadeIn();