javascript - CSS - De-blur an image while fading it in - Stack Overflow

I've got this piece of CSS (crossbrowser):#theimg {filter: blur(0px);animation: fadein 6s ease 0 1

I've got this piece of CSS (crossbrowser):

#theimg {
    filter: blur(0px);
    animation: fadein 6s ease 0 1;

    /* Safari and Chrome: */
    -webkit-filter: blur(0px); 
    -webkit-animation: fadein 6s ease 0 1;

}

@keyframes fadein { 
  from {
      -webkit-filter: blur(10px);
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
  filter: alpha(opacity=0);
  -moz-opacity: 0;
  opacity: 0;
    }
  to {
      -webkit-filter: blur(0px);
     -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
  filter: alpha(opacity=100);
  -moz-opacity: 1;
  opacity: 1;
    }    
}

@-webkit-keyframes fadein { /* Safari and Chrome: */
  from {
      -webkit-filter: blur(10px);
  -khtml-opacity: 0;
  opacity: 0;
    }
  to {
      -webkit-filter: blur(0px);
  -khtml-opacity: 1;
  opacity: 1;
    }    
}

And it works cross browser (except the blur...). However, in Google Chrome, the image fades in, but doesn't de-blur at the same time. If I exclude the fading in, it will de-blur.

How can I fix this?

I've got this piece of CSS (crossbrowser):

#theimg {
    filter: blur(0px);
    animation: fadein 6s ease 0 1;

    /* Safari and Chrome: */
    -webkit-filter: blur(0px); 
    -webkit-animation: fadein 6s ease 0 1;

}

@keyframes fadein { 
  from {
      -webkit-filter: blur(10px);
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
  filter: alpha(opacity=0);
  -moz-opacity: 0;
  opacity: 0;
    }
  to {
      -webkit-filter: blur(0px);
     -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
  filter: alpha(opacity=100);
  -moz-opacity: 1;
  opacity: 1;
    }    
}

@-webkit-keyframes fadein { /* Safari and Chrome: */
  from {
      -webkit-filter: blur(10px);
  -khtml-opacity: 0;
  opacity: 0;
    }
  to {
      -webkit-filter: blur(0px);
  -khtml-opacity: 1;
  opacity: 1;
    }    
}

And it works cross browser (except the blur...). However, in Google Chrome, the image fades in, but doesn't de-blur at the same time. If I exclude the fading in, it will de-blur.

How can I fix this?

Share Improve this question edited Oct 4, 2013 at 16:03 Isaiah asked Oct 3, 2013 at 18:45 IsaiahIsaiah 1,9124 gold badges24 silver badges50 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

You don't need jQuery for this.

Set this CSS:

#theimg {
    -webkit-filter: blur(0px);
    -webkit-animation: fadein linear 3.5s;
}

@-webkit-keyframes fadein {
   0% {    -webkit-filter: blur(10px);}
  28% { -webkit-filter: blur(10px);}
 100% {  -webkit-filter: blur(0px);}
}

and it works (no jQuery)

demo

Sorry, I miss the point about the opacity.

The problem is that Chrome has problems handling filters and opacity at the same time. You should go fully the filter way, and use the opacity of the filter:

@-webkit-keyframes fadein {
   0% {    -webkit-filter: opacity(0%) blur(10px);}
  50% { -webkit-filter: opacity(100%)  blur(10px);}
 100% {  -webkit-filter: opacity(100%) blur(0px);}
}

updated demo

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745400646a4626083.html

相关推荐

  • javascript - CSS - De-blur an image while fading it in - Stack Overflow

    I've got this piece of CSS (crossbrowser):#theimg {filter: blur(0px);animation: fadein 6s ease 0 1

    4小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信