Explorar o código

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

Naotoshi Fujita %!s(int64=3) %!d(string=hai) anos
pai
achega
c46f6248c3
Modificáronse 2 ficheiros con 2 adicións e 2 borrados
  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) {