Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed video playing after next/prev click #2436

Merged
merged 1 commit into from
Jan 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading