diff --git a/js/qsm-quiz.js b/js/qsm-quiz.js index 50af5e8b2..fbb41bbdf 100644 --- a/js/qsm-quiz.js +++ b/js/qsm-quiz.js @@ -1284,6 +1284,7 @@ function qmnInitPagination(quiz_id) { jQuery(document).on("click", ".qsm-quiz-container-" + quiz_id + " .mlw_next", function (event) { let quiz_id = +jQuery(this).closest('.qmn_quiz_container').find('.qmn_quiz_id').val(); + qsmPauseVideo(quiz_id, this); jQuery(document).trigger('qsm_auto_next_button_click_before', [quiz_id]); event.preventDefault(); let $quizForm = QSM.getQuizForm(quiz_id); @@ -1315,6 +1316,7 @@ function qmnInitPagination(quiz_id) { jQuery(document).on("click", ".qsm-quiz-container-" + quiz_id + " .mlw_previous", function (event) { event.preventDefault(); var quiz_id = +jQuery(this).closest('.qmn_quiz_container').find('.qmn_quiz_id').val(); + qsmPauseVideo(quiz_id, this); qmnPrevSlide(qmn_quiz_data[quiz_id].pagination.amount, 1, '#quizForm' + quiz_id); jQuery(document).trigger('qsm_previous_button_click_after', [quiz_id]); }); @@ -1328,6 +1330,14 @@ function qmnInitPagination(quiz_id) { jQuery(document).trigger('qsm_init_pagination_after', [quiz_id, qmn_quiz_data]); } +function qsmPauseVideo( quiz_id, btn ) { + let video_sections = jQuery(btn).closest(`.qsm-quiz-container-${quiz_id}.qmn_quiz_container`).find('video:visible'); + video_sections.each(function() { + if (!this.paused) { + this.pause(); + } + }); +} function qmnSocialShare(network, mlw_qmn_social_text, mlw_qmn_title, facebook_id, share_url) { var sTop = window.screen.height / 2 - (218); var sLeft = window.screen.width / 2 - (313);