Question:How can I change the value of css custom property by 1 on button click using jQuery?
I want to change the value by 1 when the next button is clicked, I tried to use this x variable and then add one to it whenever the next button is clicked but it didn’t work. What should i do to get the code working, if I want the x variable to increase by 1 when i click on the next button.
CSSStyleDeclaration.getPropertyValue()to get the current
--slider-indexvalue, assign to a variable, such as
x, and pre-increment it’s value, as in:
If you don’t need to use the
--slider-indexvalue in that code block again, you can skip assigning to a variable and just add one to the current
If you have better answer, please add a comment about this, thank you!