Spaces:
Running
Running
File size: 43,801 Bytes
2c2de05 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LearnPath | Discover Your Ideal Learning Style & Career</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
.learning-card {
perspective: 1000px;
}
.card-inner {
transition: transform 0.8s;
transform-style: preserve-3d;
}
.card-flipped {
transform: rotateY(180deg);
}
.card-front, .card-back {
backface-visibility: hidden;
position: absolute;
width: 100%;
height: 100%;
}
.card-back {
transform: rotateY(180deg);
}
.progress-dot {
transition: all 0.3s ease;
}
.fade-in {
animation: fadeIn 0.5s ease-in;
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
.career-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}
</style>
</head>
<body class="bg-gradient-to-br from-blue-50 to-indigo-50 min-h-screen font-sans">
<div class="container mx-auto px-4 py-8 max-w-6xl">
<!-- Header -->
<header class="text-center mb-12">
<div class="w-20 h-20 mx-auto mb-4 bg-white rounded-full shadow-md flex items-center justify-center">
<i class="fas fa-graduation-cap text-3xl text-indigo-600"></i>
</div>
<h1 class="text-4xl font-bold text-indigo-800 mb-2">LearnPath</h1>
<p class="text-lg text-gray-600">Discover your learning style and find your perfect career match</p>
</header>
<!-- Main App Container -->
<div id="app" class="bg-white rounded-xl shadow-xl overflow-hidden">
<!-- Welcome Screen -->
<div id="welcome-screen" class="p-8 text-center fade-in">
<div class="max-w-md mx-auto">
<img src="https://illustrations.popsy.co/amber/graduate.svg" alt="Learning illustration" class="w-64 mx-auto mb-8">
<h2 class="text-2xl font-semibold text-gray-800 mb-4">Ready to Discover Your Learning Superpowers?</h2>
<p class="text-gray-600 mb-8">
This 12-question assessment will identify your dominant learning style and suggest careers that align with your natural strengths and interests.
</p>
<button id="start-btn" class="bg-gradient-to-r from-indigo-600 to-blue-600 hover:from-indigo-700 hover:to-blue-700 text-white font-medium py-3 px-8 rounded-full transition-all transform hover:scale-105 shadow-md">
Start Assessment
</button>
<div class="mt-6 text-sm text-gray-500">
<i class="fas fa-clock mr-1"></i> Takes about 5 minutes
</div>
</div>
</div>
<!-- Assessment Screen -->
<div id="assessment-screen" class="hidden">
<!-- Progress Dots -->
<div class="flex justify-center space-x-2 py-4 bg-gray-50">
<div class="progress-dot w-3 h-3 rounded-full bg-gray-300" data-question="0"></div>
<div class="progress-dot w-3 h-3 rounded-full bg-gray-300" data-question="1"></div>
<div class="progress-dot w-3 h-3 rounded-full bg-gray-300" data-question="2"></div>
<div class="progress-dot w-3 h-3 rounded-full bg-gray-300" data-question="3"></div>
<div class="progress-dot w-3 h-3 rounded-full bg-gray-300" data-question="4"></div>
<div class="progress-dot w-3 h-3 rounded-full bg-gray-300" data-question="5"></div>
<div class="progress-dot w-3 h-3 rounded-full bg-gray-300" data-question="6"></div>
<div class="progress-dot w-3 h-3 rounded-full bg-gray-300" data-question="7"></div>
<div class="progress-dot w-3 h-3 rounded-full bg-gray-300" data-question="8"></div>
<div class="progress-dot w-3 h-3 rounded-full bg-gray-300" data-question="9"></div>
<div class="progress-dot w-3 h-3 rounded-full bg-gray-300" data-question="10"></div>
<div class="progress-dot w-3 h-3 rounded-full bg-gray-300" data-question="11"></div>
</div>
<!-- Question Container -->
<div class="p-8">
<div class="learning-card relative h-96 mb-8">
<!-- Question Card -->
<div id="question-card" class="card-inner w-full h-full bg-white rounded-lg shadow-md p-6 relative">
<!-- Front of Card (Question) -->
<div class="card-front flex flex-col">
<div class="flex justify-between items-start mb-6">
<span id="question-number" class="text-sm font-medium text-indigo-600 bg-indigo-50 px-3 py-1 rounded-full">Question 1 of 12</span>
<button id="flip-btn" class="text-gray-400 hover:text-indigo-500">
<i class="fas fa-info-circle"></i>
</button>
</div>
<h3 id="question-text" class="text-xl font-medium text-gray-800 mb-6 flex-grow">When learning something new, I prefer to:</h3>
<div id="options-container" class="grid gap-4">
<!-- Options will be inserted here -->
</div>
</div>
<!-- Back of Card (Explanation) -->
<div class="card-back bg-indigo-50 p-6 rounded-lg">
<div class="flex justify-between items-start mb-4">
<span class="text-sm font-medium text-indigo-600 bg-white px-3 py-1 rounded-full">Did You Know?</span>
<button id="flip-back-btn" class="text-gray-400 hover:text-indigo-500">
<i class="fas fa-times"></i>
</button>
</div>
<p id="question-explanation" class="text-gray-700">
There are four main learning styles: Visual (learn by seeing), Auditory (learn by hearing), Reading/Writing (learn by processing text), and Kinesthetic (learn by doing). Most people have a dominant style but use a mix of all four.
</p>
</div>
</div>
</div>
<!-- Navigation -->
<div class="flex justify-between items-center">
<button id="prev-btn" class="text-gray-500 hover:text-indigo-600 font-medium py-2 px-4 rounded-lg disabled:opacity-50" disabled>
<i class="fas fa-arrow-left mr-2"></i> Back
</button>
<button id="next-btn" class="bg-indigo-600 hover:bg-indigo-700 text-white font-medium py-2 px-6 rounded-lg disabled:opacity-50" disabled>
Next <i class="fas fa-arrow-right ml-2"></i>
</button>
</div>
</div>
</div>
<!-- Results Screen -->
<div id="results-screen" class="hidden p-8">
<div class="text-center mb-12">
<div class="w-24 h-24 mx-auto mb-6 bg-green-100 rounded-full flex items-center justify-center">
<i class="fas fa-star text-4xl text-green-500"></i>
</div>
<h2 class="text-2xl font-semibold text-gray-800 mb-2">Your Learning Profile</h2>
<p class="text-gray-600 max-w-2xl mx-auto">Based on your answers, here's your learning style breakdown and career suggestions that match your strengths.</p>
</div>
<!-- Learning Style Results -->
<div class="mb-12">
<h3 class="text-xl font-medium text-gray-800 mb-6 text-center">Your Learning Style Composition</h3>
<div class="grid md:grid-cols-2 gap-8 items-center">
<div id="learning-chart" class="bg-white p-6 rounded-xl shadow-sm">
<!-- Chart will be rendered here -->
<div class="flex justify-center items-center h-64">
<div id="chart-placeholder" class="text-gray-400">
<i class="fas fa-chart-pie text-5xl mb-2"></i>
<p>Loading your learning style chart...</p>
</div>
</div>
</div>
<div id="learning-description" class="space-y-4">
<!-- Description will be inserted here -->
</div>
</div>
</div>
<!-- Career Recommendations -->
<div class="mb-12">
<h3 class="text-xl font-medium text-gray-800 mb-6 text-center">Recommended Career Paths</h3>
<div id="career-grid" class="grid md:grid-cols-3 gap-6">
<!-- Career cards will be inserted here -->
</div>
</div>
<!-- Action Buttons -->
<div class="text-center mt-10">
<button id="restart-btn" class="bg-indigo-600 hover:bg-indigo-700 text-white font-medium py-3 px-8 rounded-full transition-all transform hover:scale-105 shadow-md mr-4">
<i class="fas fa-redo mr-2"></i> Take Again
</button>
<button id="resources-btn" class="bg-white border border-indigo-200 hover:bg-indigo-50 text-indigo-600 font-medium py-3 px-8 rounded-full transition-all transform hover:scale-105 shadow-md">
<i class="fas fa-book mr-2"></i> Learning Resources
</button>
</div>
</div>
</div>
<!-- Footer -->
<footer class="mt-12 text-center text-sm text-gray-500">
<p>© 2023 LearnPath. Educational assessment tool.</p>
<p class="mt-1">Results are suggestions only - many factors contribute to career success.</p>
</footer>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
// DOM Elements
const welcomeScreen = document.getElementById('welcome-screen');
const assessmentScreen = document.getElementById('assessment-screen');
const resultsScreen = document.getElementById('results-screen');
const startBtn = document.getElementById('start-btn');
const prevBtn = document.getElementById('prev-btn');
const nextBtn = document.getElementById('next-btn');
const flipBtn = document.getElementById('flip-btn');
const flipBackBtn = document.getElementById('flip-back-btn');
const questionCard = document.getElementById('question-card');
const questionText = document.getElementById('question-text');
const questionExplanation = document.getElementById('question-explanation');
const questionNumber = document.getElementById('question-number');
const progressDots = document.querySelectorAll('.progress-dot');
const optionsContainer = document.getElementById('options-container');
const learningDescription = document.getElementById('learning-description');
const careerGrid = document.getElementById('career-grid');
const restartBtn = document.getElementById('restart-btn');
const resourcesBtn = document.getElementById('resources-btn');
// Assessment Data
const questions = [
{
text: "When learning something new, I prefer to:",
explanation: "Your initial approach to learning reveals your natural preferences.",
options: [
{ text: "See diagrams, charts, or demonstrations", value: "visual", icon: "fa-eye" },
{ text: "Listen to explanations or discussions", value: "auditory", icon: "fa-assistive-listening-systems" },
{ text: "Try it out hands-on or move around", value: "kinesthetic", icon: "fa-hands" },
{ text: "Read detailed instructions or texts", value: "reading", icon: "fa-book-open" }
]
},
{
text: "I remember information best when I:",
explanation: "Memory retention varies by learning style.",
options: [
{ text: "See it written down or visualized", value: "visual", icon: "fa-eye" },
{ text: "Hear it explained or discussed", value: "auditory", icon: "fa-assistive-listening-systems" },
{ text: "Do something physical with it", value: "kinesthetic", icon: "fa-hands" },
{ text: "Write it down or summarize it", value: "reading", icon: "fa-book-open" }
]
},
{
text: "When giving directions to someone, I tend to:",
explanation: "How you communicate information often reflects your preferred learning style.",
options: [
{ text: "Draw a map or diagram", value: "visual", icon: "fa-eye" },
{ text: "Explain verbally with landmarks", value: "auditory", icon: "fa-assistive-listening-systems" },
{ text: "Show them by walking them through it", value: "kinesthetic", icon: "fa-hands" },
{ text: "Write down step-by-step instructions", value: "reading", icon: "fa-book-open" }
]
},
{
text: "In my free time, I most enjoy:",
explanation: "Your leisure activities can indicate your natural learning preferences.",
options: [
{ text: "Watching movies or looking at art", value: "visual", icon: "fa-eye" },
{ text: "Listening to music or podcasts", value: "auditory", icon: "fa-assistive-listening-systems" },
{ text: "Sports, crafts, or hands-on hobbies", value: "kinesthetic", icon: "fa-hands" },
{ text: "Reading books or writing", value: "reading", icon: "fa-book-open" }
]
},
{
text: "When solving a problem, I usually:",
explanation: "Problem-solving approaches often align with learning styles.",
options: [
{ text: "Draw diagrams or visualize solutions", value: "visual", icon: "fa-eye" },
{ text: "Talk it through with someone", value: "auditory", icon: "fa-assistive-listening-systems" },
{ text: "Try different approaches physically", value: "kinesthetic", icon: "fa-hands" },
{ text: "Make lists of possible solutions", value: "reading", icon: "fa-book-open" }
]
},
{
text: "In a classroom setting, I learn best when the teacher:",
explanation: "Different teaching methods appeal to different learning styles.",
options: [
{ text: "Uses visual aids and demonstrations", value: "visual", icon: "fa-eye" },
{ text: "Gives clear verbal explanations", value: "auditory", icon: "fa-assistive-listening-systems" },
{ text: "Includes hands-on activities", value: "kinesthetic", icon: "fa-hands" },
{ text: "Provides detailed written materials", value: "reading", icon: "fa-book-open" }
]
},
{
text: "When studying for a test, I find it most helpful to:",
explanation: "Study techniques that work best for you reveal your learning preferences.",
options: [
{ text: "Use color-coded notes and diagrams", value: "visual", icon: "fa-eye" },
{ text: "Record and listen to key points", value: "auditory", icon: "fa-assistive-listening-systems" },
{ text: "Create flashcards or physical models", value: "kinesthetic", icon: "fa-hands" },
{ text: "Rewrite and summarize notes", value: "reading", icon: "fa-book-open" }
]
},
{
text: "I tend to get distracted by:",
explanation: "What distracts you can indicate what learning environment suits you best.",
options: [
{ text: "Cluttered or disorganized visuals", value: "visual", icon: "fa-eye" },
{ text: "Background noise or conversations", value: "auditory", icon: "fa-assistive-listening-systems" },
{ text: "The need to move or fidget", value: "kinesthetic", icon: "fa-hands" },
{ text: "Poorly written or unclear text", value: "reading", icon: "fa-book-open" }
]
},
{
text: "When assembling furniture or a gadget, I typically:",
explanation: "Your approach to hands-on tasks shows your kinesthetic learning tendencies.",
options: [
{ text: "Look at the pictures in the manual", value: "visual", icon: "fa-eye" },
{ text: "Ask someone to explain the steps", value: "auditory", icon: "fa-assistive-listening-systems" },
{ text: "Start putting it together immediately", value: "kinesthetic", icon: "fa-hands" },
{ text: "Read the instructions carefully first", value: "reading", icon: "fa-book-open" }
]
},
{
text: "When learning a new skill, I prefer to start by:",
explanation: "Your initial approach to new skills reflects your learning style.",
options: [
{ text: "Watching someone demonstrate it", value: "visual", icon: "fa-eye" },
{ text: "Listening to explanations about it", value: "auditory", icon: "fa-assistive-listening-systems" },
{ text: "Jumping in and trying it out", value: "kinesthetic", icon: "fa-hands" },
{ text: "Reading about how to do it", value: "reading", icon: "fa-book-open" }
]
},
{
text: "In a meeting or lecture, I'm most likely to:",
explanation: "Your natural behavior in information-sharing settings indicates your learning preferences.",
options: [
{ text: "Take visual notes with diagrams", value: "visual", icon: "fa-eye" },
{ text: "Focus on listening carefully", value: "auditory", icon: "fa-assistive-listening-systems" },
{ text: "Fidget or doodle to stay focused", value: "kinesthetic", icon: "fa-hands" },
{ text: "Write detailed notes", value: "reading", icon: "fa-book-open" }
]
},
{
text: "When choosing a book, I'm most attracted to:",
explanation: "Your reading preferences can reveal aspects of your learning style.",
options: [
{ text: "Books with lots of pictures or diagrams", value: "visual", icon: "fa-eye" },
{ text: "Audiobooks or books with dialogue", value: "auditory", icon: "fa-assistive-listening-systems" },
{ text: "Interactive books with activities", value: "kinesthetic", icon: "fa-hands" },
{ text: "Detailed, well-written texts", value: "reading", icon: "fa-book-open" }
]
}
];
// Career Recommendations by Learning Style
const careerRecommendations = {
visual: [
{ title: "Graphic Designer", icon: "fa-paint-brush", description: "Create visual concepts to communicate ideas that inspire, inform, and captivate consumers." },
{ title: "Architect", icon: "fa-building", description: "Plan and design buildings, creating both functional and artistic structures." },
{ title: "Photographer", icon: "fa-camera", description: "Use technical expertise and creativity to capture images that tell a story." },
{ title: "Surgeon", icon: "fa-heartbeat", description: "Perform operations requiring precise visual-spatial skills and hand-eye coordination." },
{ title: "Pilot", icon: "fa-plane", description: "Navigate aircraft using visual references and instrument readings." }
],
auditory: [
{ title: "Musician", icon: "fa-music", description: "Perform, compose, or teach music, relying on auditory skills and rhythm." },
{ title: "Psychologist", icon: "fa-comments", description: "Help people through listening and verbal communication." },
{ title: "Broadcast Journalist", icon: "fa-microphone", description: "Research and present news stories through spoken word." },
{ title: "Language Interpreter", icon: "fa-language", description: "Convert information from one language to another in real-time." },
{ title: "Customer Service Rep", icon: "fa-headset", description: "Assist customers primarily through phone conversations." }
],
kinesthetic: [
{ title: "Athlete", icon: "fa-running", description: "Compete in sports requiring physical coordination and movement." },
{ title: "Chef", icon: "fa-utensils", description: "Prepare food using hands-on techniques and creative presentation." },
{ title: "Physical Therapist", icon: "fa-hands-helping", description: "Help patients improve movement through hands-on techniques." },
{ title: "Mechanic", icon: "fa-car", description: "Repair vehicles using tools and physical problem-solving." },
{ title: "Dancer", icon: "fa-child", description: "Express ideas through movement and physical performance." }
],
reading: [
{ title: "Writer", icon: "fa-pen-fancy", description: "Create written content across various genres and formats." },
{ title: "Lawyer", icon: "fa-gavel", description: "Analyze complex documents and argue cases based on written law." },
{ title: "Librarian", icon: "fa-book", description: "Organize and manage information resources in written form." },
{ title: "Researcher", icon: "fa-microscope", description: "Conduct studies and document findings in written reports." },
{ title: "Editor", icon: "fa-edit", description: "Review and improve written materials for publication." }
]
};
// Learning Style Descriptions
const styleDescriptions = {
visual: {
title: "Visual Learner",
icon: "fa-eye",
color: "text-blue-500",
bgColor: "bg-blue-50",
description: "You learn best when information is presented visually through pictures, diagrams, charts, and demonstrations. You likely think in images and benefit from visual representations of information.",
strengths: [
"Strong visual memory",
"Good at reading maps and charts",
"Notice visual details others miss",
"Artistic and creative"
],
tips: [
"Use color coding in your notes",
"Create mind maps and diagrams",
"Watch instructional videos",
"Sit where you can see clearly in classrooms"
]
},
auditory: {
title: "Auditory Learner",
icon: "fa-assistive-listening-systems",
color: "text-green-500",
bgColor: "bg-green-50",
description: "You learn best through listening. Lectures, discussions, and verbal explanations help you understand concepts. You likely remember what you hear and benefit from talking through ideas.",
strengths: [
"Good at remembering names and conversations",
"Strong verbal communication skills",
"Musical ability",
"Talented at oral presentations"
],
tips: [
"Record lectures to listen again later",
"Participate in study groups",
"Read aloud or explain concepts to others",
"Use rhymes or songs to remember information"
]
},
kinesthetic: {
title: "Kinesthetic Learner",
icon: "fa-hands",
color: "text-yellow-500",
bgColor: "bg-yellow-50",
description: "You learn best by doing and through physical activity. Hands-on experiences and movement help you understand and retain information. You likely think best while moving and benefit from active learning.",
strengths: [
"Excellent hand-eye coordination",
"Good at sports and physical activities",
"Quick reflexes",
"Strong muscle memory"
],
tips: [
"Take frequent study breaks to move around",
"Use physical objects to learn concepts",
"Study while exercising (like on a treadmill)",
"Act out or physically demonstrate ideas"
]
},
reading: {
title: "Reading/Writing Learner",
icon: "fa-book-open",
color: "text-purple-500",
bgColor: "bg-purple-50",
description: "You learn best through written words. Reading and writing activities help you process information most effectively. You likely enjoy lists, notes, and textbooks as learning tools.",
strengths: [
"Strong reading comprehension",
"Excellent writing skills",
"Good at taking notes",
"Talented at research and documentation"
],
tips: [
"Rewrite notes in your own words",
"Create detailed outlines",
"Read supplementary materials",
"Write summaries of what you learn"
]
}
};
// App State
let currentQuestion = 0;
let answers = Array(questions.length).fill(null);
let styleScores = {
visual: 0,
auditory: 0,
kinesthetic: 0,
reading: 0
};
let dominantStyle = '';
// Event Listeners
startBtn.addEventListener('click', startAssessment);
prevBtn.addEventListener('click', showPreviousQuestion);
nextBtn.addEventListener('click', showNextQuestion);
flipBtn.addEventListener('click', flipCard);
flipBackBtn.addEventListener('click', flipCard);
restartBtn.addEventListener('click', restartAssessment);
resourcesBtn.addEventListener('click', showResources);
// Functions
function startAssessment() {
welcomeScreen.classList.add('hidden');
assessmentScreen.classList.remove('hidden');
updateQuestion();
}
function updateQuestion() {
const question = questions[currentQuestion];
questionText.textContent = question.text;
questionExplanation.textContent = question.explanation;
questionNumber.textContent = `Question ${currentQuestion + 1} of ${questions.length}`;
// Clear previous options
optionsContainer.innerHTML = '';
// Add new options
question.options.forEach(option => {
const optionBtn = document.createElement('button');
optionBtn.className = 'option-btn bg-indigo-50 hover:bg-indigo-100 text-indigo-700 font-medium py-3 px-4 rounded-lg transition-all text-left';
optionBtn.dataset.value = option.value;
// Highlight if this option was previously selected
if (answers[currentQuestion] === option.value) {
optionBtn.classList.add('bg-indigo-200', 'text-indigo-800');
optionBtn.classList.remove('bg-indigo-50');
}
optionBtn.innerHTML = `
<i class="fas ${option.icon} mr-2 text-indigo-500"></i> ${option.text}
`;
optionBtn.addEventListener('click', function() {
selectOption(this);
});
optionsContainer.appendChild(optionBtn);
});
// Update progress dots
progressDots.forEach(dot => {
const dotQuestion = parseInt(dot.dataset.question);
if (dotQuestion < currentQuestion) {
dot.classList.remove('bg-gray-300');
dot.classList.add('bg-indigo-500');
} else if (dotQuestion === currentQuestion) {
dot.classList.remove('bg-gray-300', 'bg-indigo-500');
dot.classList.add('bg-indigo-300');
} else {
dot.classList.remove('bg-indigo-500', 'bg-indigo-300');
dot.classList.add('bg-gray-300');
}
});
// Update navigation buttons
prevBtn.disabled = currentQuestion === 0;
nextBtn.disabled = answers[currentQuestion] === null;
}
function showPreviousQuestion() {
if (currentQuestion > 0) {
currentQuestion--;
updateQuestion();
}
}
function showNextQuestion() {
if (answers[currentQuestion] !== null) {
if (currentQuestion < questions.length - 1) {
currentQuestion++;
updateQuestion();
} else {
calculateResults();
showResults();
}
}
}
function selectOption(selectedBtn) {
const selectedValue = selectedBtn.dataset.value;
answers[currentQuestion] = selectedValue;
// Update UI for selected option
const optionBtns = document.querySelectorAll('.option-btn');
optionBtns.forEach(btn => {
if (btn.dataset.value === selectedValue) {
btn.classList.add('bg-indigo-200', 'text-indigo-800');
btn.classList.remove('bg-indigo-50');
} else {
btn.classList.remove('bg-indigo-200', 'text-indigo-800');
btn.classList.add('bg-indigo-50');
}
});
nextBtn.disabled = false;
}
function flipCard() {
questionCard.classList.toggle('card-flipped');
}
function calculateResults() {
// Reset scores
Object.keys(styleScores).forEach(style => {
styleScores[style] = 0;
});
// Calculate scores for each style
answers.forEach(answer => {
if (answer) {
styleScores[answer]++;
}
});
// Find dominant style
let maxScore = 0;
Object.entries(styleScores).forEach(([style, score]) => {
if (score > maxScore) {
maxScore = score;
dominantStyle = style;
}
});
}
function showResults() {
assessmentScreen.classList.add('hidden');
resultsScreen.classList.remove('hidden');
// Display learning style description
const dominantStyleData = styleDescriptions[dominantStyle];
learningDescription.innerHTML = `
<div class="flex items-center mb-4">
<div class="w-12 h-12 rounded-full ${dominantStyleData.bgColor} flex items-center justify-center mr-4">
<i class="fas ${dominantStyleData.icon} text-xl ${dominantStyleData.color}"></i>
</div>
<h3 class="text-xl font-semibold text-gray-800">Your Dominant Style: ${dominantStyleData.title}</h3>
</div>
<p class="text-gray-700 mb-4">${dominantStyleData.description}</p>
<div class="grid md:grid-cols-2 gap-6">
<div>
<h4 class="font-medium text-gray-800 mb-2">Your Strengths:</h4>
<ul class="list-disc list-inside text-gray-700 space-y-1">
${dominantStyleData.strengths.map(strength => `<li>${strength}</li>`).join('')}
</ul>
</div>
<div>
<h4 class="font-medium text-gray-800 mb-2">Learning Tips:</h4>
<ul class="list-disc list-inside text-gray-700 space-y-1">
${dominantStyleData.tips.map(tip => `<li>${tip}</li>`).join('')}
</ul>
</div>
</div>
`;
// Display career recommendations
careerGrid.innerHTML = '';
// Get top 3 styles (including ties)
const sortedStyles = Object.entries(styleScores)
.sort((a, b) => b[1] - a[1])
.map(item => item[0]);
// Combine career recommendations from top styles
const recommendedCareers = [];
sortedStyles.slice(0, 2).forEach(style => {
careerRecommendations[style].slice(0, 2).forEach(career => {
if (!recommendedCareers.some(c => c.title === career.title)) {
recommendedCareers.push(career);
}
});
});
// Fill with additional careers from dominant style if needed
if (recommendedCareers.length < 6) {
careerRecommendations[dominantStyle].forEach(career => {
if (recommendedCareers.length < 6 && !recommendedCareers.some(c => c.title === career.title)) {
recommendedCareers.push(career);
}
});
}
// Display career cards
recommendedCareers.forEach(career => {
const careerCard = document.createElement('div');
careerCard.className = 'career-card bg-white rounded-lg shadow-md p-6 border-t-4 border-indigo-200 transition-all';
careerCard.innerHTML = `
<div class="flex items-center mb-4">
<div class="w-10 h-10 rounded-full bg-indigo-50 flex items-center justify-center mr-3">
<i class="fas ${career.icon} text-indigo-500"></i>
</div>
<h3 class="font-medium text-gray-800">${career.title}</h3>
</div>
<p class="text-gray-600 text-sm">${career.description}</p>
`;
careerGrid.appendChild(careerCard);
});
// Create pie chart visualization
createLearningChart();
}
function createLearningChart() {
// In a real app, you would use a charting library like Chart.js
// This is a simplified visualization for demonstration
const chartPlaceholder = document.getElementById('chart-placeholder');
chartPlaceholder.innerHTML = `
<div class="relative w-48 h-48 mx-auto">
<!-- Visual -->
<div class="absolute inset-0 rounded-full bg-blue-100 flex items-center justify-center"
style="clip-path: polygon(50% 50%, 50% 0%, ${50 + 40 * (styleScores.visual / 12) * Math.cos(Math.PI/4)}% ${50 - 40 * (styleScores.visual / 12) * Math.sin(Math.PI/4)}%)">
<div class="w-16 h-16 rounded-full bg-blue-200 flex items-center justify-center">
<i class="fas fa-eye text-blue-600"></i>
</div>
</div>
<!-- Auditory -->
<div class="absolute inset-0 rounded-full bg-green-100 flex items-center justify-center"
style="clip-path: polygon(50% 50%, 50% 0%, ${50 + 40 * (styleScores.auditory / 12) * Math.cos(3*Math.PI/4)}% ${50 + 40 * (styleScores.auditory / 12) * Math.sin(3*Math.PI/4)}%)">
<div class="w-16 h-16 rounded-full bg-green-200 flex items-center justify-center">
<i class="fas fa-assistive-listening-systems text-green-600"></i>
</div>
</div>
<!-- Kinesthetic -->
<div class="absolute inset-0 rounded-full bg-yellow-100 flex items-center justify-center"
style="clip-path: polygon(50% 50%, 50% 0%, ${50 + 40 * (styleScores.kinesthetic / 12) * Math.cos(5*Math.PI/4)}% ${50 + 40 * (styleScores.kinesthetic / 12) * Math.sin(5*Math.PI/4)}%)">
<div class="w-16 h-16 rounded-full bg-yellow-200 flex items-center justify-center">
<i class="fas fa-hands text-yellow-600"></i>
</div>
</div>
<!-- Reading -->
<div class="absolute inset-0 rounded-full bg-purple-100 flex items-center justify-center"
style="clip-path: polygon(50% 50%, 50% 0%, ${50 + 40 * (styleScores.reading / 12) * Math.cos(7*Math.PI/4)}% ${50 - 40 * (styleScores.reading / 12) * Math.sin(7*Math.PI/4)}%)">
<div class="w-16 h-16 rounded-full bg-purple-200 flex items-center justify-center">
<i class="fas fa-book-open text-purple-600"></i>
</div>
</div>
</div>
<div class="mt-6 flex justify-center space-x-6">
<div class="flex items-center">
<div class="w-3 h-3 rounded-full bg-blue-500 mr-2"></div>
<span class="text-sm">Visual (${styleScores.visual})</span>
</div>
<div class="flex items-center">
<div class="w-3 h-3 rounded-full bg-green-500 mr-2"></div>
<span class="text-sm">Auditory (${styleScores.auditory})</span>
</div>
<div class="flex items-center">
<div class="w-3 h-3 rounded-full bg-yellow-500 mr-2"></div>
<span class="text-sm">Kinesthetic (${styleScores.kinesthetic})</span>
</div>
<div class="flex items-center">
<div class="w-3 h-3 rounded-full bg-purple-500 mr-2"></div>
<span class="text-sm">Reading (${styleScores.reading})</span>
</div>
</div>
`;
}
function restartAssessment() {
currentQuestion = 0;
answers = Array(questions.length).fill(null);
styleScores = {
visual: 0,
auditory: 0,
kinesthetic: 0,
reading: 0
};
dominantStyle = '';
resultsScreen.classList.add('hidden');
welcomeScreen.classList.remove('hidden');
}
function showResources() {
alert("In a complete application, this would show recommended books, courses, and learning strategies tailored to your dominant learning style.");
}
});
</script>
</html> |