From 46cf2fa83ff4a763a62203a1a4789243344ab8c8 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 18 Oct 2015 15:31:25 +0100 Subject: [PATCH] Improve carousel sliding behaviour, rewind on slide begin, play on slide end --- js/app.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/js/app.js b/js/app.js index 00cc5652a..3fb5026f5 100644 --- a/js/app.js +++ b/js/app.js @@ -4,11 +4,17 @@ var cs_demos = $("#carousel-demos"); if (cs_demos) { - cs_demos.on("slid.bs.carousel", function (e) { + cs_demos.on("slide.bs.carousel", function (e) { var video = $(e.relatedTarget).find("video"); - if (video) { video[0].currentTime = 0; + video[0].pause(); + } + }); + cs_demos.on("slid.bs.carousel", function (e) { + var video = $(e.relatedTarget).find("video"); + if (video) { + video[0].play(); } }); }