[英]Avoiding a CSS3 box-shadow to be seen while fading in a <li>
I'm fading in some <li>
elements (boxes) when my users click a button. 当用户单击按钮时,我正在淡入一些
<li>
元素(框)。 The boxes used to have PNG backgrounds and now I'm replacing them with pure CSS. 这些盒子曾经有PNG背景 ,现在我要用纯CSS代替它们。 I'm using Getting clever with CSS3 Shadows , using
li:after
. 我使用的是CSS3 Shadows变得越来越聪明 ,使用
li:after
。
The problem with this method is that when I fadeIn
the boxes they'll naturally have opacity and thus the shadow will be seen through . 这种方法的问题是,当我在
fadeIn
的盒子里时,它们自然就会变得不透明,因此阴影会被看透 。
Setting the box-shadow
on the <li>
element doesn't create the shadow effect I'm after. 在
<li>
元素上设置box-shadow
不会创建我想要的阴影效果。 I tried creating a that I append once the fadeIn is complete, and it sorta works but is noticeable. 我尝试创建一个在fadingIn完成后追加的附件,它可以工作但很明显。
Any ideas on a better way? 有更好的主意吗?
Could do with by wrapping it all up in a "wrapper" element inside the li element and then fading the li element. 可以通过将所有内容包装在li元素内的“包装器”元素中然后使li元素褪色来实现。
Example: http://jsfiddle.net/petersendidit/ncBtV/1/embedded/result/ 示例: http : //jsfiddle.net/petersendidit/ncBtV/1/embedded/result/
Only tested it in Chrome dev and Firefox 4 仅在Chrome开发人员和Firefox 4中进行了测试
Can you add a class when the animation is completed... 动画制作完成后,您可以添加课程吗?
li.completed-fade {
box-shadow: ...
}
$('li').fadeIn(500, function() { $(this).addClass('completed-fade'); });
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.