Skip to content

Commit e0101ab

Browse files
committed
Pause all iframe videos when carouseling
1 parent fe1b2c4 commit e0101ab

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

js/application.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,13 @@ $(document).ready(function() {
2424
});
2525
$("[data-behavior*=carousel]").
2626
on("jcarousel:scroll", function(event, carousel, target, animate) {
27-
var iframe = document.querySelector('iframe');
28-
var player = new Vimeo.Player(iframe);
27+
var iframes = document.querySelectorAll('iframe');
2928

30-
player.pause();
29+
iframes.forEach(function(iframe) {
30+
var player = new Vimeo.Player(iframe);
31+
32+
player.pause();
33+
});
3134
});
3235
}
3336
});

0 commit comments

Comments
 (0)