fix: correct parameter usage for modal detection
Replaced the incorrect parameter check from 'embed' to 'modal' for determining if the quiz is in a modal. This resolves the issue where modals weren't closing as expected when the 'modal' parameter was set in the URL.
This commit is contained in:
parent
ffb3945e19
commit
1f00277f60
1 changed files with 2 additions and 1 deletions
|
@ -54,6 +54,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||||
console.log("Bootstrap loaded successfully");
|
console.log("Bootstrap loaded successfully");
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
var embedded = getUrlParameter("embed");
|
var embedded = getUrlParameter("embed");
|
||||||
|
var inModal = getUrlParameter("modal");
|
||||||
|
|
||||||
// Set required attribute on inputs associated with labels containing <i title="Required field">
|
// Set required attribute on inputs associated with labels containing <i title="Required field">
|
||||||
$('label:has(i[title="Required field"])').each(function () {
|
$('label:has(i[title="Required field"])').each(function () {
|
||||||
|
@ -100,7 +101,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||||
data: formData,
|
data: formData,
|
||||||
success: function (response) {
|
success: function (response) {
|
||||||
// Close the modal if `modal=1` is set
|
// Close the modal if `modal=1` is set
|
||||||
if (embedded === "1") {
|
if (inModal === "1") {
|
||||||
window.top.closeQuizModal();
|
window.top.closeQuizModal();
|
||||||
} else {
|
} else {
|
||||||
// Else call the nextContent function
|
// Else call the nextContent function
|
||||||
|
|
Loading…
Reference in a new issue