Here's Your Match!
කෙල්ලෝ: [
"https://i.ibb.co/02XgdB0/images-4.jpg",
"https://i.ibb.co/mXBHH3Q/images-3.jpg"
]
};
let currentStep = 1;
function nextQuestion() {
document.querySelector(`.question[data-step="${currentStep}"]`).classList.remove('active');
currentStep++;
document.querySelector(`.question[data-step="${currentStep}"]`).classList.add('active');
}
function showResult() {
const gender = document.getElementById('gender').value;
const oppositeGender = gender === 'male' ? 'female' : 'male'; // Get opposite gender
const randomIndex = Math.floor(Math.random() * images[oppositeGender].length);
document.getElementById('matchImage').src = images[oppositeGender][randomIndex];
document.getElementById('survey').style.display = 'none';
document.getElementById('result').style.display = 'block';
}
function restart() {
currentStep = 1;
document.getElementById('survey').style.display = 'block';
document.getElementById('result').style.display = 'none';
document.querySelectorAll('.question').forEach(q => q.classList.remove('active'));
document.querySelector(`.question[data-step="1"]`).classList.add('active');
}