Browse Source

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

Naotoshi Fujita 3 years ago
parent
commit
c46f6248c3
2 changed files with 2 additions and 2 deletions
  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) {