Browse Source

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

Naotoshi Fujita 3 years ago
parent
commit
3a3b2870c6

+ 1 - 1
dist/js/splide.js

@@ -475,7 +475,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
 
     function update() {
       if (!paused) {
-        rate = min((now() - startTime) / interval, 1);
+        rate = interval ? min((now() - startTime) / interval, 1) : 1;
         onUpdate && onUpdate(rate);
 
         if (rate >= 1) {

File diff suppressed because it is too large
+ 0 - 0
dist/js/splide.min.js


BIN
dist/js/splide.min.js.gz


File diff suppressed because it is too large
+ 0 - 0
dist/js/splide.min.js.map


+ 1 - 1
src/js/constructors/RequestInterval/RequestInterval.ts

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

+ 15 - 13
src/js/test/php/examples/default.php

@@ -22,26 +22,28 @@ $settings = get_settings();
     document.addEventListener( 'DOMContentLoaded', function () {
       var splide = new Splide( '#splide01', {
         width: 800,
-        // type        : 'loop',
-        perPage: 3,
+        type        : 'loop',
+        perPage: 2,
         // rewind: true,
         // rewindByDrag: true,
-        padding: { left: '3rem', right: '2rem' },
+        padding: '3rem',
         updateOnMove: true,
         direction: 'ltr',
         height: undefined,
         paginationDirection: 'ttb',
         rewindSpeed: 2000,
-
-        breakpoints: {
-          1200: {
-            // padding: 5,
-          },
-          1000: {
-            label: 'The destroyed carousel',
-            destroy: true,
-          },
-        },
+        // role: '',
+        label: '1',
+
+        // breakpoints: {
+        //   1200: {
+        //     // padding: 5,
+        //   },
+        //   1000: {
+        //     label: 'The destroyed carousel',
+        //     destroy: true,
+        //   },
+        // },
 
         classes: {
           arrows: 'splide__arrows custom-arrows',

Some files were not shown because too many files changed in this diff