We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 626c79f commit ba2668cCopy full SHA for ba2668c
source/scripts/index.js
@@ -143,9 +143,11 @@ class Slider {
143
}
144
145
set currentState(newState) {
146
- this._currentState = Math.max(0, Math.min(newState, 1));
+ const updatedState = Math.max(0, Math.min(newState, 1));
147
+ const isNeedUpdate = updatedState !== this._currentState;
148
+ this._currentState = updatedState;
149
- if (this._rafId === null) {
150
+ if (this._rafId === null && isNeedUpdate) {
151
this._rafId = requestAnimationFrame(() => {
152
this._sliderElement.style.setProperty('--slider-state', this._currentState);
153
this._rafId = null;
0 commit comments