Skip to content

Commit

Permalink
Merge pull request #2436 from QuizandSurveyMaster/CU-86cu6w0zk-video-…
Browse files Browse the repository at this point in the history
…continues-after-next-prev

Fixed video playing after next/prev click
  • Loading branch information
zubairraeen authored Jan 3, 2024
2 parents f512397 + 3a61f68 commit 98a0290
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions js/qsm-quiz.js
Original file line number Diff line number Diff line change
Expand Up @@ -1286,7 +1286,6 @@ 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 @@ -1318,7 +1317,6 @@ 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 @@ -1332,9 +1330,9 @@ 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');
let iframeVideos = jQuery(btn).closest(`.qsm-quiz-container-${quiz_id}.qmn_quiz_container`).find('iframe:visible');
jQuery(document).on('qsm_next_button_click_after qsm_previous_button_click_after', function(event, quiz_id) {
let video_sections = jQuery(`.qsm-quiz-container-${quiz_id}.qmn_quiz_container`).find('video');
let iframeVideos = jQuery(`.qsm-quiz-container-${quiz_id}.qmn_quiz_container`).find('iframe');

iframeVideos.each(function() {
let src = this.src;
Expand All @@ -1345,7 +1343,7 @@ function qsmPauseVideo( quiz_id, btn ) {
this.pause();
}
});
}
});

function qmnSocialShare(network, mlw_qmn_social_text, mlw_qmn_title, facebook_id, share_url) {
var sTop = window.screen.height / 2 - (218);
Expand Down

0 comments on commit 98a0290

Please sign in to comment.