Answer the question
In order to leave comments, you need to log in
How to make friends jQuery animate filter saturate?
Hello, I'm having some trouble with the jQuery animate filter saturate.
.block {
filter: saturate(0%);
background: url('http://hdwyn.com/wallpaper_1600x900/canada_british_columbia_mountain_lake_1600x900_hd-wallpaper-96912.jpg') center center / cover no-repeat transparent;
}
jQuery(document).ready(function($) {
jQuery(".block").animate({'filter':'saturate(100%)'},2000);
})
Answer the question
In order to leave comments, you need to log in
$(function () {
$({saturate: 0}).animate({saturate: 100}, {
duration: 2000,
easing: 'swing', // linear
step: function () {
$('.block').css({
'-webkit-filter': 'saturate(' + this.saturate + '%)',
'filter': 'saturate(' + this.saturate + '%)'
});
}
});
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question