Animate blur filter

前端 未结 4 2112
感动是毒
感动是毒 2020-12-15 07:08

Is it possible to animate the CSS3 blur filter using jQuery?

This works as a static way of applying CSS rules :

item.css({\'filter\': \'blur(\'+blur         


        
4条回答
  •  情书的邮戳
    2020-12-15 07:24

    One Google Search query gave me this result you might wanna take a look at. What I suggest to do is only toggle a class in your JS and handle the rest in your CSS, for instance:

    var $item = $('.item'); // or any selector you want to use
    $item.addClass('item--blur');
    

    Handle the rest in your CSS:

    .item {
        transition: all 0.25s ease-out;
    }
    .item--blur {
        // all your filters
    }
    

提交回复
热议问题