I am trying to change the background opacity of a div using a jquery ui slider.
The user can change the background color of the div, so I need to know how I can only change the alpha parameter of the background without changing the color.
This is my code so far:
$('#opacity-slider').slider({ min: 0, max: 1, step: 0.1, value: 1 })
.bind("slidechange", function() {
//get the value of the slider with this call
var o = $(this).slider('value');
var e = $('.element-active');
var currentColor = $('.element-active').css('background-color');
$(e).css('background-color', 'rgba(255, 255, 255, '+o+')')
});
I need to some how change only the alpha part of the currentColor variable. I hope someone can help me! TIA