Skip to content

Commit

Permalink
fix(autoplay): use local scope for autoplay resize timeot
Browse files Browse the repository at this point in the history
fixes #6590
  • Loading branch information
nolimits4web committed Apr 17, 2023
1 parent 26cfbaa commit 4f665bd
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/core/events/onResize.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
let timeout;
export default function onResize() {
const swiper = this;

Expand Down Expand Up @@ -42,8 +41,8 @@ export default function onResize() {
}

if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) {
clearTimeout(timeout);
timeout = setTimeout(() => {
clearTimeout(swiper.autoplay.resizeTimeout);
swiper.autoplay.resizeTimeout = setTimeout(() => {
if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) {
swiper.autoplay.resume();
}
Expand Down

0 comments on commit 4f665bd

Please sign in to comment.