javascript 在图像上从左到右淡入淡出效果

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14193028/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 20:58:13  来源:igfitidea点击:

Fade effect left to right on a image

javascriptjquery

提问by Slaythern Aareonna

I have fade effect structure. With the following:

我有淡入淡出效果结构。具有以下内容:

  <img src='firstStar.jpg' alt='star image' id='firstStar' />

    var loopImages = function(){

         $('#firstStar').fadeIn(1500, function(){

                   $('#firstStar').fadeOut(1500, loopImages);           
         });
    }
    loopImages();

It's working. But i want, this effect get left to right. Is it possible?

它正在工作。但我想要,这种效果从左到右。是否可以?

回答by semir.babajic

You can try with this, I used to work with it on my previous project.

你可以试试这个,我曾经在我以前的项目中使用过它。

http://jonobr1.github.com/diagonalFade/

http://jonobr1.github.com/diagonalFade/

Hope it fits your needs.

希望它符合您的需求。

Regards.

问候。

回答by Alessandro Minoccheri

You can try something like this with animate

你可以尝试这样的事情 animate

$(document).ready(function(){
    $("#firstStar").animate({left:200, opacity:"show"}, 1500);
});

Make sure the div is initially hidden (style="display:none;").

确保 div 最初是隐藏的(style="display:none;")。

回答by Vikram

By 'But i want, this effect get left to right', do you mean to refer this one?

'但我想要,这种效果从左到右',你的意思是指这个吗?

http://www.oik-plugins.com/wordpress-plugins-from-oik-plugins/wordpress-plugins/oik-nivo-slider/nivo-settings/nivo-slider-transition-effects/nivo-slider-effectslicedownright/

http://www.oik-plugins.com/wordpress-plugins-from-oik-plugins/wordpress-plugins/oik-nivo-slider/nivo-settings/nivo-slider-transition-effects/nivo-slider-effectslicedownright/

If yes, then you can use the effect called as sliceDownRight.

如果是,那么您可以使用称为 as 的效果sliceDownRight