File size: 10,505 Bytes
c8d0139
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html lang="ko">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>λ‚˜μ—κ²Œ μ–΄μšΈλ¦¬λŠ” μ—¬ν–‰μ§€ μ°ΎκΈ° ✈️</title>
    <style>
        body {
            font-family: 'Arial', sans-serif;
            line-height: 1.6;
            background-color: #f4f4f4;
            color: #333;
            margin: 0;
            padding: 20px;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
        }

        .quiz-container {
            background-color: #fff;
            padding: 30px;
            border-radius: 8px;
            box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
            max-width: 600px;
            width: 100%;
            text-align: center;
        }

        h1 {
            color: #0056b3;
            margin-bottom: 20px;
        }

        .question-container {
            margin-bottom: 20px;
        }

        .question-container p {
            font-size: 1.2em;
            margin-bottom: 15px;
            font-weight: bold;
        }

        .options button {
            display: block;
            width: 100%;
            padding: 12px;
            margin-bottom: 10px;
            border: 1px solid #ccc;
            border-radius: 5px;
            background-color: #eee;
            font-size: 1em;
            cursor: pointer;
            transition: background-color 0.3s ease;
        }

        .options button:hover {
            background-color: #ddd;
        }

        .options button:active {
            background-color: #ccc;
        }

        .result-container {
            display: none; /* μ΄ˆκΈ°μ—λŠ” μˆ¨κΉ€ */
            text-align: center;
        }

        .result-container h2 {
            color: #28a745;
            margin-bottom: 15px;
        }

        .result-container p {
            font-size: 1.1em;
            margin-bottom: 20px;
        }

        .result-container a {
            display: inline-block;
            background-color: #ff5722; /* 쿠팑 μ˜€λ Œμ§€μƒ‰ λŠλ‚Œ */
            color: white;
            padding: 12px 25px;
            border-radius: 5px;
            text-decoration: none;
            font-size: 1.1em;
            transition: background-color 0.3s ease;
        }

        .result-container a:hover {
            background-color: #e64a19;
        }

        /* 질문 숨기기/보이기 μ• λ‹ˆλ©”μ΄μ…˜ */
        .question-container.hidden {
            display: none;
            opacity: 0;
            transition: opacity 0.5s ease;
        }
        .question-container.visible {
             display: block;
             opacity: 1;
             transition: opacity 0.5s ease;
        }

    </style>
</head>
<body>

    <div class="quiz-container">
        <h1>λ‚˜μ—κ²Œ μ–΄μšΈλ¦¬λŠ” μ—¬ν–‰μ§€ μ°ΎκΈ° ✈️</h1>
        <div id="intro" class="question-container visible">
            <p>λͺ‡ κ°€μ§€ μ§ˆλ¬Έμ— λ‹΅ν•˜κ³  λ‹Ήμ‹ μ—κ²Œ λ”± λ§žλŠ” μ—¬ν–‰μ§€λ₯Ό μ°Ύμ•„λ³΄μ„Έμš”!</p>
            <div class="options">
                 <button onclick="startQuiz()">ν€΄μ¦ˆ μ‹œμž‘ν•˜κΈ°</button>
            </div>
        </div>

        <div id="question1" class="question-container hidden">
            <p>1. μ–΄λ–€ μ’…λ₯˜μ˜ 여행을 κ°€μž₯ μ’‹μ•„ν•˜μ‹œλ‚˜μš”?</p>
            <div class="options">
                <button onclick="answerQuestion(1, 'relax')">ν‘Ή μ‰¬λŠ” νœ΄μ–‘ μ—¬ν–‰ πŸ–οΈ</button>
                <button onclick="answerQuestion(1, 'activity')">μ‹ λ‚˜λŠ” μ•‘ν‹°λΉ„ν‹° μ—¬ν–‰ πŸ§—β€β™€οΈ</button>
                <button onclick="answerQuestion(1, 'culture')">λ‹€μ–‘ν•œ λ¬Έν™”λ₯Ό κ²½ν—˜ν•˜λŠ” μ—¬ν–‰ πŸ›οΈ</button>
            </div>
        </div>

        <div id="question2" class="question-container hidden">
            <p>2. μ—¬ν–‰μ§€μ—μ„œ κ°€μž₯ μ€‘μš”ν•˜κ²Œ μƒκ°ν•˜λŠ” 것은?</p>
            <div class="options">
                <button onclick="answerQuestion(2, 'nature')">μ•„λ¦„λ‹€μš΄ μžμ—° κ²½κ΄€ 🏞️</button>
                <button onclick="answerQuestion(2, 'food')">λ§›μžˆλŠ” ν˜„μ§€ μŒμ‹ 🍲</button>
                <button onclick="answerQuestion(2, 'shopping')">λ‹€μ–‘ν•œ μ‡Όν•‘ 기회 πŸ›οΈ</button>
            </div>
        </div>

        <div id="question3" class="question-container hidden">
            <p>3. μ—¬ν–‰ μ˜ˆμ‚°μ€ μ–΄λŠ 정도 μƒκ°ν•˜μ‹œλ‚˜μš”?</p>
            <div class="options">
                <button onclick="answerQuestion(3, 'low')">μ €λ ΄ν•˜κ²Œ μ¦κΈ°λŠ” μ—¬ν–‰ πŸ’°</button>
                <button onclick="answerQuestion(3, 'medium')">μ λ‹Ήνžˆ νˆ¬μžν•˜λŠ” μ—¬ν–‰ πŸ˜‰</button>
                <button onclick="answerQuestion(3, 'high')">μ˜ˆμ‚° 상관없이 μ¦κΈ°λŠ” μ—¬ν–‰ λŸ­μ…”λ¦¬ν•˜κ²Œ ✨</button>
            </div>
        </div>

         <div id="question4" class="question-container hidden">
            <p>4. λˆ„κ΅¬μ™€ ν•¨κ»˜ μ—¬ν–‰ν•˜λŠ” 것을 μ„ ν˜Έν•˜μ‹œλ‚˜μš”?</p>
            <div class="options">
                <button onclick="answerQuestion(4, 'alone')">혼자만의 μ‹œκ°„ 즐기기 🚢</button>
                <button onclick="answerQuestion(4, 'friends')">친ꡬ λ˜λŠ” 연인과 ν•¨κ»˜ πŸ‘«</button>
                <button onclick="answerQuestion(4, 'family')">κ°€μ‘±κ³Ό μ†Œμ€‘ν•œ μΆ”μ–΅ λ§Œλ“€κΈ° πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦</button>
            </div>
        </div>


        <div id="result" class="result-container">
            <h2>λ‹Ήμ‹ μ—κ²Œ μ–΄μšΈλ¦¬λŠ” μ—¬ν–‰μ§€λŠ”...</h2>
            <p id="result-text"></p>
            <a id="coupang-link" href="#" target="_blank">μΏ νŒ‘μ—μ„œ κ΄€λ ¨ μ—¬ν–‰ μƒν’ˆ 찾아보기 ✈️</a>
        </div>
    </div>

    <script>
        let currentQuestion = 0;
        const questions = ['intro', 'question1', 'question2', 'question3', 'question4']; // 질문 ID λͺ©λ‘
        const answers = {}; // μ‚¬μš©μžμ˜ 닡변을 μ €μž₯ν•  객체

        function startQuiz() {
            document.getElementById('intro').classList.remove('visible');
            document.getElementById('intro').classList.add('hidden');
            currentQuestion++;
            showQuestion(currentQuestion);
        }

        function showQuestion(index) {
            if (index > questions.length - 1) {
                showResult();
                return;
            }

            // 이전 질문 숨기기 (λ§Œμ•½ μžˆλ‹€λ©΄)
            if (currentQuestion > 0) {
                 const prevQuestionId = questions[currentQuestion - 1];
                 const prevQuestionElement = document.getElementById(prevQuestionId);
                 if (prevQuestionElement) {
                      prevQuestionElement.classList.remove('visible');
                      prevQuestionElement.classList.add('hidden');
                 }
            }


            const currentQuestionId = questions[index];
            const currentQuestionElement = document.getElementById(currentQuestionId);
            if (currentQuestionElement) {
                 currentQuestionElement.classList.remove('hidden');
                 currentQuestionElement.classList.add('visible');
            }
        }

        function answerQuestion(questionNumber, answer) {
            answers[questionNumber] = answer; // λ‹΅λ³€ μ €μž₯
            currentQuestion++;
            showQuestion(currentQuestion); // λ‹€μŒ 질문으둜 이동
        }

        function showResult() {
            // λͺ¨λ“  μ§ˆλ¬Έμ„ μˆ¨κΉλ‹ˆλ‹€.
            questions.forEach(id => {
                const element = document.getElementById(id);
                if (element) {
                    element.classList.remove('visible');
                    element.classList.add('hidden');
                }
            });

            const resultElement = document.getElementById('result');
            const resultTextElement = document.getElementById('result-text');
            const coupangLinkElement = document.getElementById('coupang-link');

            let result = "";
            let coupangLink = "#"; // κΈ°λ³Έ 쿠팑 링크 (λ‚˜μ€‘μ— μ‹€μ œ 링크둜 λ³€κ²½ ν•„μš”)

            // κ°„λ‹¨ν•œ 둜직으둜 κ²°κ³Ό κ²°μ • (각 λ‹΅λ³€μ˜ 쑰합에 따라 λ‹€λ₯Έ κ²°κ³Ό λ„μΆœ)
            // 이 뢀뢄은 더 λ³΅μž‘ν•œ 둜직으둜 λ°œμ „μ‹œν‚¬ 수 μžˆμŠ΅λ‹ˆλ‹€.
            if (answers[1] === 'relax' && answers[2] === 'nature') {
                result = "μ•„λ¦„λ‹€μš΄ ν•΄λ³€κ°€ νœ΄μ–‘μ§€ πŸ–οΈ";
                coupangLink = "https://www.coupang.com/np/search?q=%ED%95%B4%EB%B3%80%EA%B0%80+%ED%9C%B4%EC%96%91&channel=user&component=list_vertical&source=user_component"; // 쿠팑 ν•΄λ³€κ°€ νœ΄μ–‘ 검색 링크 (μ˜ˆμ‹œ)
            } else if (answers[1] === 'activity' && answers[3] === 'medium') {
                result = "μ‹ λ‚˜λŠ” μ•‘ν‹°λΉ„ν‹° λ„μ‹œ μ—¬ν–‰ πŸ™οΈ";
                 coupangLink = "https://www.coupang.com/np/search?q=%EB%8F%84%EC%8B%9C+%EC%97%AC%ED%96%89+%EC%95%A1%ED%8B%B0%EB%B9%84%ED%8B%B0&channel=user&component=list_vertical&source=user_component"; // 쿠팑 λ„μ‹œ μ—¬ν–‰ μ•‘ν‹°λΉ„ν‹° 검색 링크 (μ˜ˆμ‹œ)
            } else if (answers[1] === 'culture' && answers[4] === 'alone') {
                result = "역사와 λ¬Έν™”κ°€ μ‚΄μ•„ μˆ¨μ‰¬λŠ” κ³³ πŸ›οΈ";
                 coupangLink = "https://www.coupang.com/np/search?q=%EB%AC%B8%ED%99%94+%EC%97%AC%ED%96%89&channel=user&component=list_vertical&source=user_component"; // 쿠팑 λ¬Έν™” μ—¬ν–‰ 검색 링크 (μ˜ˆμ‹œ)
            } else if (answers[3] === 'low' && answers[4] === 'friends') {
                 result = "μ €λ ΄ν•˜κ²Œ μ¦κΈ°λŠ” λ°°λ‚­μ—¬ν–‰ λͺ…μ†Œ πŸŽ’";
                  coupangLink = "https://www.coupang.com/np/search?q=%EB%B0%B0%EB%82%AD%EC%97%AC%ED%96%85+%EB%AA%85%EC%86%8C&channel=user&component=list_vertical&source=user_component"; // 쿠팑 λ°°λ‚­μ—¬ν–‰ λͺ…μ†Œ 검색 링크 (μ˜ˆμ‹œ)
            }
            // 더 λ‹€μ–‘ν•œ κ²°κ³Ό 쑰합을 μΆ”κ°€ν•  수 μžˆμŠ΅λ‹ˆλ‹€.
            else {
                result = "λ‹Ήμ‹ μ—κ²ŒλŠ” λ‹€μ±„λ‘œμš΄ κ²½ν—˜μ΄ κ°€λ“ν•œ 여행이 μ–΄μšΈλ¦½λ‹ˆλ‹€! 🌍";
                 coupangLink = "https://www.coupang.com/np/search?q=%ED%95%B4%EC%99%B8%EC%97%AC%ED%96%85&channel=user&component=list_vertical&source=user_component"; // 쿠팑 ν•΄μ™Έμ—¬ν–‰ μΉ΄ν…Œκ³ λ¦¬ 링크 (μ˜ˆμ‹œ)
            }


            resultTextElement.innerText = result;
            coupangLinkElement.href = coupangLink; // 쿠팑 링크 μ„€μ •

            resultElement.style.display = 'block'; // κ²°κ³Ό μ»¨ν…Œμ΄λ„ˆ ν‘œμ‹œ
        }

    </script>

</body>
</html>