Lashtw commited on
Commit
c75a099
·
verified ·
1 Parent(s): f58f8f9

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +173 -18
index.html CHANGED
@@ -1,19 +1,174 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  </html>
 
1
+ <!DOCTYPE html>
2
+ <html lang="zh-TW">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>洋蔥式穿搭測驗</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <style>
9
+ @import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;700&display=swap');
10
+ body {
11
+ font-family: 'Noto Sans TC', sans-serif;
12
+ background-color: #f0f4f8;
13
+ }
14
+ </style>
15
+ </head>
16
+ <body class="bg-gray-100 min-h-screen flex items-center justify-center p-4">
17
+
18
+ <div id="quiz-container" class="bg-white rounded-xl shadow-lg p-8 w-full max-w-lg transition-all duration-300 transform">
19
+ <h1 class="text-3xl font-bold text-center text-gray-800 mb-6">洋蔥式穿搭測驗</h1>
20
+
21
+ <div id="quiz-question" class="transition-opacity duration-500 ease-in-out">
22
+ <h2 id="question-text" class="text-xl font-semibold text-gray-700 mb-4"></h2>
23
+ <div id="answer-options" class="space-y-4"></div>
24
+ </div>
25
+
26
+ <div id="quiz-result" class="hidden text-center transition-opacity duration-500 ease-in-out">
27
+ <h2 class="text-2xl font-bold text-green-600 mb-4">測驗完成!</h2>
28
+ <p class="text-xl text-gray-700">你的分數是:<span id="score" class="font-bold text-3xl text-blue-600"></span> / <span id="total-questions" class="font-bold text-3xl text-blue-600"></span></p>
29
+ <p id="result-message" class="mt-4 text-gray-600"></p>
30
+ <button id="restart-btn" class="mt-6 px-6 py-3 bg-blue-500 text-white rounded-full font-bold shadow-lg hover:bg-blue-600 transition-all duration-300">重新開始</button>
31
+ </div>
32
+ </div>
33
+
34
+ <div id="feedback-modal" class="fixed inset-0 bg-black bg-opacity-50 hidden items-center justify-center p-4 z-50">
35
+ <div class="bg-white rounded-lg p-6 max-w-sm w-full text-center shadow-2xl">
36
+ <p id="feedback-text" class="text-xl font-bold mb-4"></p>
37
+ <button id="next-btn" class="px-6 py-2 bg-blue-500 text-white rounded-full hover:bg-blue-600 transition-all duration-300">下一題</button>
38
+ </div>
39
+ </div>
40
+
41
+ <script>
42
+ const questions = [
43
+ {
44
+ question: "洋蔥式穿搭中,最貼近皮膚的「基礎層」主要功能是什麼?",
45
+ options: ["防風防水", "鎖住熱空氣", "排汗"],
46
+ answer: "排汗"
47
+ },
48
+ {
49
+ question: "以下哪種材質最不適合用作洋蔥式穿搭的「基礎層」?",
50
+ options: ["羊毛", "聚酯纖維", "棉質"],
51
+ answer: "棉質"
52
+ },
53
+ {
54
+ question: "「保暖層」的主要功能是透過捕捉什麼來保持身體溫暖?",
55
+ options: ["水分", "熱空氣", "光線"],
56
+ answer: "熱空氣"
57
+ },
58
+ {
59
+ question: "「防護層」的主要功能是防風和防水,這層最常見的設計是什麼?",
60
+ options: ["透氣拉鍊", "隱藏式口袋", "可拆式帽子"],
61
+ answer: "透氣拉鍊"
62
+ },
63
+ {
64
+ question: "在寒冷的天氣下,為什麼穿著濕掉的棉質衣物會讓人覺得更冷?",
65
+ options: ["因為水會吸收太陽熱能", "因為水會加速身體熱量散失", "因為棉質衣物會變得更重"],
66
+ answer: "因為水會加速身體熱量散失"
67
+ },
68
+ {
69
+ question: "如果你覺得身體很熱,但又不想脫掉整件外套,可以怎麼做來調節體溫?",
70
+ options: ["把帽子戴起來", "拉開外套的透氣拉鍊", "繫緊外套的袖口"],
71
+ answer: "拉開外套的透氣拉鍊"
72
+ },
73
+ {
74
+ question: "保暖層如果被雨淋濕,會發生什麼事?",
75
+ options: ["保暖效果會更好", "會變得更輕", "會失去鎖住熱空氣的能力"],
76
+ answer: "會失去鎖住熱空氣的能力"
77
+ },
78
+ {
79
+ question: "為什麼「防護層」的防風功能很重要?",
80
+ options: ["因為風會讓衣服變得太重", "因為風會吹散保暖層裡鎖住的熱空氣", "因為風會讓衣服顏色變淡"],
81
+ answer: "因為風會吹散保暖層裡鎖住的熱空氣"
82
+ },
83
+ {
84
+ question: "洋蔥式穿搭最主要的好處是什麼?",
85
+ options: ["讓外觀看起來更時尚", "可以減少衣物數量", "方便根據環境變化調節體溫"],
86
+ answer: "方便根據環境變化調節體溫"
87
+ },
88
+ {
89
+ question: "哪一層是為了應對強風和下雨等外部環境變化?",
90
+ options: ["基礎層", "保暖層", "防護層"],
91
+ answer: "防護層"
92
+ }
93
+ ];
94
+
95
+ let currentQuestionIndex = 0;
96
+ let score = 0;
97
+
98
+ const quizQuestionDiv = document.getElementById('quiz-question');
99
+ const questionText = document.getElementById('question-text');
100
+ const answerOptionsDiv = document.getElementById('answer-options');
101
+ const quizResultDiv = document.getElementById('quiz-result');
102
+ const scoreSpan = document.getElementById('score');
103
+ const totalQuestionsSpan = document.getElementById('total-questions');
104
+ const resultMessage = document.getElementById('result-message');
105
+ const restartBtn = document.getElementById('restart-btn');
106
+ const feedbackModal = document.getElementById('feedback-modal');
107
+ const feedbackText = document.getElementById('feedback-text');
108
+ const nextBtn = document.getElementById('next-btn');
109
+
110
+ function showQuestion() {
111
+ if (currentQuestionIndex < questions.length) {
112
+ const q = questions[currentQuestionIndex];
113
+ questionText.textContent = q.question;
114
+ answerOptionsDiv.innerHTML = '';
115
+ q.options.forEach(option => {
116
+ const button = document.createElement('button');
117
+ button.textContent = option;
118
+ button.className = "w-full py-3 px-4 bg-gray-200 text-gray-700 font-medium rounded-full hover:bg-blue-500 hover:text-white transition-colors duration-300 shadow-md";
119
+ button.onclick = () => checkAnswer(option);
120
+ answerOptionsDiv.appendChild(button);
121
+ });
122
+ } else {
123
+ showResults();
124
+ }
125
+ }
126
+
127
+ function checkAnswer(selectedOption) {
128
+ const q = questions[currentQuestionIndex];
129
+ const isCorrect = selectedOption === q.answer;
130
+ if (isCorrect) {
131
+ score += 10;
132
+ feedbackText.textContent = "答對了!";
133
+ feedbackText.className = "text-xl font-bold text-green-600 mb-4";
134
+ } else {
135
+ feedbackText.textContent = `答錯了... 正確答案是:「${q.answer}」`;
136
+ feedbackText.className = "text-xl font-bold text-red-600 mb-4";
137
+ }
138
+ feedbackModal.style.display = 'flex';
139
+ }
140
+
141
+ nextBtn.onclick = () => {
142
+ feedbackModal.style.display = 'none';
143
+ currentQuestionIndex++;
144
+ showQuestion();
145
+ };
146
+
147
+ function showResults() {
148
+ quizQuestionDiv.classList.add('hidden');
149
+ quizResultDiv.classList.remove('hidden');
150
+ scoreSpan.textContent = score;
151
+ totalQuestionsSpan.textContent = 100;
152
+ if (score === 100) {
153
+ resultMessage.textContent = "太棒了!你完全掌握了洋蔥式穿搭的精髓!";
154
+ } else if (score >= 60) {
155
+ resultMessage.textContent = "做得很好!再多練習幾次,你就能完全掌握了!";
156
+ } else {
157
+ resultMessage.textContent = "沒關係,洋蔥式穿搭需要多練習。可以回到前面再複習一次喔!";
158
+ }
159
+ }
160
+
161
+ restartBtn.onclick = () => {
162
+ currentQuestionIndex = 0;
163
+ score = 0;
164
+ quizResultDiv.classList.add('hidden');
165
+ quizQuestionDiv.classList.remove('hidden');
166
+ showQuestion();
167
+ };
168
+
169
+ document.addEventListener('DOMContentLoaded', () => {
170
+ showQuestion();
171
+ });
172
+ </script>
173
+ </body>
174
  </html>