I am currently working on adjusting the background opacity of a div using a jquery ui slider.
Allowing users to modify the background color of the div, I am seeking guidance on how to adjust only the alpha parameter of the background while keeping the color constant.
This is the code snippet I have developed thus far:
$('#opacity-slider').slider({ min: 0, max: 1, step: 0.1, value: 1 })
.bind("slidechange", function() {
//fetch the slider value
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 am looking for a solution to manipulate solely the alpha portion of the currentColor variable. Any help or insights would be greatly appreciated! Thank you in advance (TIA).