I have css variables defined within a css class.
.popup {
--popup-opacity: 0;
--popup-visibility: hidden;
opacity: var(--popup-opacity);
visibility: var(--popup-visibility);
}
I want to update this using javascript. The following code works if variables are within root element:
document.documentElement.style.setProperty('--popup-opacity', 1);
document.documentElement.style.setProperty('--popup-visibility', 'visible');
I cannot figure out how to make it work when variables are defined within the css class. Please help.