I would like to use CSS Variables and change them globally via jQuery.
Here is some code:
$("div").click(function() {
// Change globally "--text_color: rgb(0, 0, 255);" to for example "--text_color: rgb(0, 255, 255);"
});
:root {
--text_color: rgb(0, 0, 255);
}
div {
color: var(--text_color);
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div>Hello</div>
Is there a way to program this?
Would be very thankful for help!