I'm trying to add several css filters dynamicaly via Jquery.
So I have one slider for the brightness and another one for the contrast.
I want them both to modify a single div.
I can easily do this with one filter but I got some difficulties getting the value of both sliders and apply them on this single div.
I tried this, but the behaviour is odd
HTML :
<input class="brightness" type="range" min="0" max="100" value="100">
<input class="saturation" type="range" min="0" max="100" value="100">
<div></div>
Jquery :
$('input').change(function(){
var $brightness_value = $('.brightness').val(),
$saturation_value = $('.contrast').val(),
$brightness_string = "brightness("+$brightness_value+"%)",
$saturation_string = "saturate("+$saturation_value+")";
$('div').css("-webkit-filter",$brightness_string+$saturation_string);
});
Any ideas ?
Thanks a lot !
$('.brighness')is missing thet. Is that in the real code or just a copying error?