Преглед изворни кода

Bug Fix: Handle the case which the `interval` is 0.

Naotoshi Fujita пре 3 година
родитељ
комит
c46f6248c3
2 измењених фајлова са 2 додато и 2 уклоњено
  1. 1 1
      dist/js/splide.cjs.js
  2. 1 1
      dist/js/splide.esm.js

+ 1 - 1
dist/js/splide.cjs.js

@@ -479,7 +479,7 @@ function RequestInterval(interval, onInterval, onUpdate, limit) {
 
   function update() {
     if (!paused) {
-      rate = min((now() - startTime) / interval, 1);
+      rate = interval ? min((now() - startTime) / interval, 1) : 1;
       onUpdate && onUpdate(rate);
 
       if (rate >= 1) {

+ 1 - 1
dist/js/splide.esm.js

@@ -474,7 +474,7 @@ function RequestInterval(interval, onInterval, onUpdate, limit) {
 
   function update() {
     if (!paused) {
-      rate = min((now() - startTime) / interval, 1);
+      rate = interval ? min((now() - startTime) / interval, 1) : 1;
       onUpdate && onUpdate(rate);
 
       if (rate >= 1) {