update
This commit is contained in:
+46
-60
@@ -46,25 +46,18 @@
|
||||
</style>
|
||||
<div class="page-sco py-2 py-md-4 h-100">
|
||||
<div class="container h-100">
|
||||
<div
|
||||
id="drag-drop-activity"
|
||||
class="row justify-content-center align-items-center h-100"
|
||||
style="overflow: hidden"
|
||||
>
|
||||
<div id="drag-drop-activity" class="row justify-content-center align-items-center h-100" style="overflow: hidden">
|
||||
<div class="col-12">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-10 mb-2">
|
||||
<h2 class="text-center fw-bold text-primary">¿Cuál es el tratamiento?</h2>
|
||||
<h2 class="text-center fw-bold text-primary">¿Cuál es el tratamiento<sup class="fw-bold">1,4</sup>?</h2>
|
||||
<hr class="border border-3 border-verde-oscuro hr-style mx-auto my-0" />
|
||||
</div>
|
||||
<div class="col-12 px-0">
|
||||
<div class="card bg-custom border-0 my-2 rounded-0 shadow p-3 text-center">
|
||||
<div class="d-flex justify-content-center align-items-center flex-row">
|
||||
<img src="img/3.1.png" class="img-fluid mx-3" />
|
||||
<p class="mb-0">
|
||||
<strong>Instrucciones:</strong> Relaciona las imágenes con la terapia a la que
|
||||
corresponden.
|
||||
</p>
|
||||
<p class="mb-0"><strong>Instrucciones:</strong> Relaciona las imágenes con la terapia a la que corresponden.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -77,23 +70,17 @@
|
||||
<div class="card bg-transparent border-0 rounded-0 shadow-none p-0">
|
||||
<div class="d-flex flex-row justify-content-center gap-3">
|
||||
<div class="content-enfermedad text-center">
|
||||
<div
|
||||
class="card rounded bg-custom-transparent border-0 shadow-none px-3 py-2 mt-2"
|
||||
>
|
||||
<div class="card rounded bg-custom-transparent border-0 shadow-none px-3 py-2 mt-2">
|
||||
<img src="img/3.2.png" class="img-fluid" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="content-enfermedad text-center">
|
||||
<div
|
||||
class="card rounded bg-custom-transparent border-0 shadow-none px-3 py-2 mt-2"
|
||||
>
|
||||
<div class="card rounded bg-custom-transparent border-0 shadow-none px-3 py-2 mt-2">
|
||||
<img src="img/3.3.png" class="img-fluid" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="content-enfermedad text-center">
|
||||
<div
|
||||
class="card rounded bg-custom-transparent border-0 shadow-none px-3 py-2 mt-2"
|
||||
>
|
||||
<div class="card rounded bg-custom-transparent border-0 shadow-none px-3 py-2 mt-2">
|
||||
<img src="img/3.4.png" class="img-fluid" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -126,26 +113,26 @@
|
||||
</div>
|
||||
<script>
|
||||
$(function () {
|
||||
"use strict";
|
||||
$(".wrap-course-content").addClass("fake");
|
||||
'use strict';
|
||||
$('.wrap-course-content').addClass('fake');
|
||||
|
||||
let questions;
|
||||
let currentQuestionIndex = 0;
|
||||
let currentQuestion;
|
||||
let correctQuestions = 0;
|
||||
const bad = CourseNav.createSound("audio/feedback-incorrect.mpeg");
|
||||
const good = CourseNav.createSound("audio/feedback-correct.mpeg");
|
||||
const bad = CourseNav.createSound('audio/feedback-incorrect.mpeg');
|
||||
const good = CourseNav.createSound('audio/feedback-correct.mpeg');
|
||||
|
||||
const urlExcelFile = "Drag_Drop.xlsx";
|
||||
const urlExcelFile = 'Drag_Drop.xlsx';
|
||||
|
||||
function readExcelFile(url, callback) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", url, true);
|
||||
xhr.responseType = "arraybuffer";
|
||||
xhr.open('GET', url, true);
|
||||
xhr.responseType = 'arraybuffer';
|
||||
xhr.onload = function (e) {
|
||||
var arrayBuffer = xhr.response;
|
||||
var data = new Uint8Array(arrayBuffer);
|
||||
var workbook = XLSX.read(data, { type: "array" });
|
||||
var workbook = XLSX.read(data, { type: 'array' });
|
||||
var result = {};
|
||||
workbook.SheetNames.forEach((sheetName) => {
|
||||
var sheet = workbook.Sheets[sheetName];
|
||||
@@ -160,10 +147,10 @@
|
||||
const preguntas = data.map((fila) => {
|
||||
const opciones = [];
|
||||
Object.keys(fila).forEach((key) => {
|
||||
if (key.startsWith("opcion")) {
|
||||
if (key.startsWith('opcion')) {
|
||||
opciones.push({
|
||||
text: fila[key].trim(),
|
||||
correct: key === "opcion_c",
|
||||
correct: key === 'opcion_c',
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -186,10 +173,10 @@
|
||||
}
|
||||
|
||||
function CreateDragAndDrop() {
|
||||
$(".content-enfermedad").each(function (index) {
|
||||
$('.content-enfermedad').each(function (index) {
|
||||
if (questions && questions[index]) {
|
||||
const dropDiv = `<div class="position-relative card bg-transparent drop-card shadow-none rounded-0 p-0 mx-auto" data-drop="${index}"></div>`;
|
||||
$(dropDiv).insertBefore($(this).find(".card"));
|
||||
$(dropDiv).insertBefore($(this).find('.card'));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -204,18 +191,18 @@
|
||||
allOptions = shuffleArray(allOptions);
|
||||
allOptions.forEach((option) => {
|
||||
const dragDiv = `<div class="card card-drag bg-verde-oscuro border-0 rounded-0 shadow-none px-3 py-2 text-white text-center" data-drag="${option.index}">${option.text}</div>`;
|
||||
$("#content-drags").append(dragDiv);
|
||||
$('#content-drags').append(dragDiv);
|
||||
});
|
||||
}
|
||||
|
||||
function initializeDragAndDrop() {
|
||||
$(".card-drag").draggable({
|
||||
revert: "invalid",
|
||||
$('.card-drag').draggable({
|
||||
revert: 'invalid',
|
||||
revertDuration: 300,
|
||||
/* containment: "#drag-drop-activity", */
|
||||
cursor: "grabbing",
|
||||
cursor: 'grabbing',
|
||||
start: function (event, ui) {
|
||||
$(this).css("z-index", 1000);
|
||||
$(this).css('z-index', 1000);
|
||||
ui.position.left = 0;
|
||||
ui.position.top = 0;
|
||||
},
|
||||
@@ -228,52 +215,51 @@
|
||||
ui.position.top = newTop;
|
||||
},
|
||||
stop: function (event, ui) {
|
||||
$(this).css("z-index", 1);
|
||||
$(this).css('z-index', 1);
|
||||
},
|
||||
});
|
||||
|
||||
$(".drop-card").droppable({
|
||||
accept: ".card-drag",
|
||||
tolerance: "pointer",
|
||||
$('.drop-card').droppable({
|
||||
accept: '.card-drag',
|
||||
tolerance: 'pointer',
|
||||
drop: function (event, ui) {
|
||||
const dragData = ui.helper.data("drag");
|
||||
const dropData = $(this).data("drop");
|
||||
const dragData = ui.helper.data('drag');
|
||||
const dropData = $(this).data('drop');
|
||||
|
||||
if (dragData == dropData) {
|
||||
good.play();
|
||||
ui.helper.css({ position: "static", top: "auto", left: "auto" }).appendTo(this);
|
||||
ui.helper.draggable("disable");
|
||||
$(this).droppable("disable");
|
||||
ui.helper.css({ position: 'static', top: 'auto', left: 'auto' }).appendTo(this);
|
||||
ui.helper.draggable('disable');
|
||||
$(this).droppable('disable');
|
||||
|
||||
// Verificar si todos están completados
|
||||
if ($(".drop-card:not(.ui-droppable-disabled)").length === 0) {
|
||||
if ($('.drop-card:not(.ui-droppable-disabled)').length === 0) {
|
||||
Completed();
|
||||
}
|
||||
} else {
|
||||
bad.play();
|
||||
ui.helper.draggable("option", "revert", true);
|
||||
ui.helper.draggable('option', 'revert', true);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function Completed() {
|
||||
const html = $("#pop0").html();
|
||||
const html = $('#pop0').html();
|
||||
Swal.fire({
|
||||
html: html,
|
||||
target: document.getElementById("wrap-course-content"),
|
||||
target: document.getElementById('wrap-course-content'),
|
||||
customClass: {
|
||||
popup: "pop_html_style border border-3 border-primary rounded-4",
|
||||
confirmButton:
|
||||
"btn text-white bg-primary amor fw-semibold animate__animated animate__pulse animate__infinite",
|
||||
popup: 'pop_html_style border border-3 border-primary rounded-4',
|
||||
confirmButton: 'btn text-white bg-primary amor fw-semibold animate__animated animate__pulse animate__infinite',
|
||||
},
|
||||
confirmButtonText: "Cerrar",
|
||||
confirmButtonText: 'Cerrar',
|
||||
showConfirmButton: true,
|
||||
allowOutsideClick: false,
|
||||
allowEscapeKey: false,
|
||||
focusConfirm: false,
|
||||
backdrop: "rgba(65, 60, 60, .95)",
|
||||
width: "35em",
|
||||
backdrop: 'rgba(65, 60, 60, .95)',
|
||||
width: '35em',
|
||||
didOpen: () => {},
|
||||
didClose: () => {
|
||||
CourseNav.audioController.stopAudio();
|
||||
@@ -288,7 +274,7 @@
|
||||
}
|
||||
|
||||
readExcelFile(urlExcelFile, function (data) {
|
||||
const hojaDatos = data["DragAndDrop"];
|
||||
const hojaDatos = data['DragAndDrop'];
|
||||
questions = procesarPreguntas(hojaDatos);
|
||||
CreateDragAndDrop();
|
||||
initializeDragAndDrop();
|
||||
@@ -298,14 +284,14 @@
|
||||
// Ajustar altura de todos los elementos .bg-custom-transparent al más alto
|
||||
function igualarAlturaBgCustomTransparent() {
|
||||
var maxHeight = 0;
|
||||
$(".bg-custom-transparent").each(function () {
|
||||
$(this).css("height", "auto"); // Resetear altura para medir correctamente
|
||||
$('.bg-custom-transparent').each(function () {
|
||||
$(this).css('height', 'auto'); // Resetear altura para medir correctamente
|
||||
var h = $(this).outerHeight();
|
||||
if (h > maxHeight) maxHeight = h;
|
||||
});
|
||||
$(".bg-custom-transparent").css("height", maxHeight + "px");
|
||||
$('.bg-custom-transparent').css('height', maxHeight + 'px');
|
||||
}
|
||||
$(window).on("resize", igualarAlturaBgCustomTransparent);
|
||||
$(window).on('resize', igualarAlturaBgCustomTransparent);
|
||||
igualarAlturaBgCustomTransparent();
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user