Skip to content

Commit

Permalink
Merge pull request #2427 from QuizandSurveyMaster/CU-86cu6w0zk-bug-wi…
Browse files Browse the repository at this point in the history
…th-video-playing

Fixed bug with video playing
  • Loading branch information
zubairraeen authored Dec 22, 2023
2 parents d7f4f7d + e3744dd commit 208d991
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions js/qsm-quiz.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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]);
});
Expand All @@ -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);
Expand Down

0 comments on commit 208d991

Please sign in to comment.