Skip to content

Commit 3a3b287

Browse files
Bug Fix: Handle the case which the interval is 0.
1 parent 0f34c52 commit 3a3b287

6 files changed

Lines changed: 19 additions & 17 deletions

File tree

dist/js/splide.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
475475

476476
function update() {
477477
if (!paused) {
478-
rate = min((now() - startTime) / interval, 1);
478+
rate = interval ? min((now() - startTime) / interval, 1) : 1;
479479
onUpdate && onUpdate(rate);
480480

481481
if (rate >= 1) {

dist/js/splide.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/splide.min.js.gz

3 Bytes
Binary file not shown.

dist/js/splide.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/js/constructors/RequestInterval/RequestInterval.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export function RequestInterval(
6363
*/
6464
function update(): void {
6565
if ( ! paused ) {
66-
rate = min( ( now() - startTime ) / interval, 1 );
66+
rate = interval ? min( ( now() - startTime ) / interval, 1 ) : 1;
6767
onUpdate && onUpdate( rate );
6868

6969
if ( rate >= 1 ) {

src/js/test/php/examples/default.php

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,28 @@
2222
document.addEventListener( 'DOMContentLoaded', function () {
2323
var splide = new Splide( '#splide01', {
2424
width: 800,
25-
// type : 'loop',
26-
perPage: 3,
25+
type : 'loop',
26+
perPage: 2,
2727
// rewind: true,
2828
// rewindByDrag: true,
29-
padding: { left: '3rem', right: '2rem' },
29+
padding: '3rem',
3030
updateOnMove: true,
3131
direction: 'ltr',
3232
height: undefined,
3333
paginationDirection: 'ttb',
3434
rewindSpeed: 2000,
35-
36-
breakpoints: {
37-
1200: {
38-
// padding: 5,
39-
},
40-
1000: {
41-
label: 'The destroyed carousel',
42-
destroy: true,
43-
},
44-
},
35+
// role: '',
36+
label: '1',
37+
38+
// breakpoints: {
39+
// 1200: {
40+
// // padding: 5,
41+
// },
42+
// 1000: {
43+
// label: 'The destroyed carousel',
44+
// destroy: true,
45+
// },
46+
// },
4547

4648
classes: {
4749
arrows: 'splide__arrows custom-arrows',

0 commit comments

Comments
 (0)