如何在jQuery中部分*淡入*? [英] How do you fade in *partially* in jQuery?

查看:69
本文介绍了如何在jQuery中部分*淡入*?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿大家。这看起来很容易,但由于某种原因,我很难拼凑在一起。我想创建一个动画淡入效果,其中div从0不透明度变为50%不透明度,并停止。



据我所知:

  var duration = 1000; 
$('#mydiv')。fadeIn(duration);

会将div淡出为100%,没有任何限制。



是否有一种优雅的方式设置完成不透明度?

解决方案

p> .fadeTo();



就是这样。



http://api.jquery.com/fadeTo/






您会注意到IE和Alpha频道的问题。



这些是可爱的FF,chrome和其余...

  opacity:0; 
-moz-opacity:0;

IE预期会看到:

  filter:alpha(opacity = x)。 


Hey everyone. This seems easy enough, but for some reason I'm having a hard time piecing it together. I want to create an animated "fade in" effect, where a div fades from 0 opacity to 50% opacity, and stops.

As far as I understand:

var duration = 1000;
$('#mydiv').fadeIn(duration);

will fade the div to 100%, with no option of limiting this.

Is there an elegant way of setting the finishing opacity?

解决方案

.fadeTo();

That's it.

http://api.jquery.com/fadeTo/


You will notice issues with IE and alpha channels.

These are lovely for FF, chrome and the rest...

opacity:0;
-moz-opacity:0;

IE expects to see this:

filter:alpha(opacity=x).

这篇关于如何在jQuery中部分*淡入*?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆