浏览代码

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) {