effect in attr ('style JavaScript

0

I need to run this grayscale filter gradually, gradually applying it gradually over a period of time.

$('#backstatic').attr('style', 'filter: grayscale(100%)');

This is my line, I would like to know if you can set the time for the filter effect to apply gradually.

    
asked by anonymous 15.06.2018 / 06:08

1 answer

1

I solved it like this:

$('#backstatic').attr('style', 'filter: grayscale(100%);transition: 2s');

I've found that adding the css3 transition style also works!

Then where 'transition:' '2s' is time.

    
15.06.2018 / 06:22