openfree commited on
Commit
3231287
ยท
verified ยท
1 Parent(s): c5fd803

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +30 -31
index.html CHANGED
@@ -214,6 +214,12 @@
214
  position: relative;
215
  overflow: hidden;
216
  user-select: none;
 
 
 
 
 
 
217
  }
218
 
219
  .option-card.selected {
@@ -1217,32 +1223,24 @@
1217
  let currentPeriod = 3;
1218
 
1219
  // ํŽ˜์ด์ง€ ๋กœ๋“œ ์‹œ ์ด๋ฒคํŠธ ๋ฆฌ์Šค๋„ˆ ๋“ฑ๋ก
1220
- window.addEventListener('DOMContentLoaded', function() {
1221
- console.log('DOM loaded, setting up click handlers...'); // ๋””๋ฒ„๊น…์šฉ
1222
 
1223
- // ์ด๋ฒคํŠธ ์œ„์ž„ ๋ฐฉ์‹์œผ๋กœ ์ฒ˜๋ฆฌ
1224
- document.addEventListener('click', function(e) {
1225
- // ํด๋ฆญ๋œ ์š”์†Œ๊ฐ€ option-card์ด๊ฑฐ๋‚˜ ๊ทธ ํ•˜์œ„ ์š”์†Œ์ธ์ง€ ํ™•์ธ
1226
- if (e.target.classList.contains('option-card')) {
1227
- handleCardClick(e.target);
1228
- } else {
1229
- // ๋ถ€๋ชจ ์š”์†Œ ์ค‘์— option-card๊ฐ€ ์žˆ๋Š”์ง€ ํ™•์ธ
1230
- let parent = e.target.parentElement;
1231
- while (parent && parent !== document.body) {
1232
- if (parent.classList.contains('option-card')) {
1233
- handleCardClick(parent);
1234
- break;
1235
- }
1236
- parent = parent.parentElement;
1237
- }
1238
- }
1239
- });
1240
- });
1241
 
1242
  // ์นด๋“œ ํด๋ฆญ ์ฒ˜๋ฆฌ ํ•จ์ˆ˜
1243
  function handleCardClick(card) {
1244
- const category = card.dataset.category;
1245
- const id = card.dataset.id;
1246
 
1247
  console.log('Card clicked:', category, id); // ๋””๋ฒ„๊น…์šฉ
1248
 
@@ -1253,24 +1251,25 @@
1253
 
1254
  if (category === 'service' || category === 'additional') {
1255
  // ๋ณต์ˆ˜ ์„ ํƒ ๊ฐ€๋Šฅ
1256
- card.classList.toggle('selected');
1257
-
1258
  if (card.classList.contains('selected')) {
1259
- if (!selectedComponents[category].includes(id)) {
1260
- selectedComponents[category].push(id);
1261
- }
1262
- } else {
1263
  const index = selectedComponents[category].indexOf(id);
1264
  if (index > -1) {
1265
  selectedComponents[category].splice(index, 1);
1266
  }
 
 
 
 
 
1267
  }
1268
  } else {
1269
  // ๋‹จ์ผ ์„ ํƒ
1270
  // ๊ฐ™์€ ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ์นด๋“œ๋“ค์˜ ์„ ํƒ ํ•ด์ œ
1271
- document.querySelectorAll(`[data-category="${category}"]`).forEach(c => {
1272
- c.classList.remove('selected');
1273
- });
 
1274
 
1275
  // ํ˜„์žฌ ์นด๋“œ ์„ ํƒ
1276
  card.classList.add('selected');
 
214
  position: relative;
215
  overflow: hidden;
216
  user-select: none;
217
+ z-index: 1;
218
+ }
219
+
220
+ .option-card * {
221
+ pointer-events: none;
222
+ user-select: none;
223
  }
224
 
225
  .option-card.selected {
 
1223
  let currentPeriod = 3;
1224
 
1225
  // ํŽ˜์ด์ง€ ๋กœ๋“œ ์‹œ ์ด๋ฒคํŠธ ๋ฆฌ์Šค๋„ˆ ๋“ฑ๋ก
1226
+ window.onload = function() {
1227
+ console.log('Window loaded, setting up click handlers...'); // ๋””๋ฒ„๊น…์šฉ
1228
 
1229
+ // ๋ชจ๋“  option-card์— onclick ์ง์ ‘ ์„ค์ •
1230
+ const cards = document.getElementsByClassName('option-card');
1231
+ console.log('Found cards:', cards.length); // ๋””๋ฒ„๊น…์šฉ
1232
+
1233
+ for (let i = 0; i < cards.length; i++) {
1234
+ cards[i].onclick = function() {
1235
+ handleCardClick(this);
1236
+ };
1237
+ }
1238
+ };
 
 
 
 
 
 
 
 
1239
 
1240
  // ์นด๋“œ ํด๋ฆญ ์ฒ˜๋ฆฌ ํ•จ์ˆ˜
1241
  function handleCardClick(card) {
1242
+ const category = card.getAttribute('data-category');
1243
+ const id = card.getAttribute('data-id');
1244
 
1245
  console.log('Card clicked:', category, id); // ๋””๋ฒ„๊น…์šฉ
1246
 
 
1251
 
1252
  if (category === 'service' || category === 'additional') {
1253
  // ๋ณต์ˆ˜ ์„ ํƒ ๊ฐ€๋Šฅ
 
 
1254
  if (card.classList.contains('selected')) {
1255
+ card.classList.remove('selected');
 
 
 
1256
  const index = selectedComponents[category].indexOf(id);
1257
  if (index > -1) {
1258
  selectedComponents[category].splice(index, 1);
1259
  }
1260
+ } else {
1261
+ card.classList.add('selected');
1262
+ if (!selectedComponents[category].includes(id)) {
1263
+ selectedComponents[category].push(id);
1264
+ }
1265
  }
1266
  } else {
1267
  // ๋‹จ์ผ ์„ ํƒ
1268
  // ๊ฐ™์€ ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ์นด๋“œ๋“ค์˜ ์„ ํƒ ํ•ด์ œ
1269
+ const sameCategory = document.querySelectorAll(`[data-category="${category}"]`);
1270
+ for (let i = 0; i < sameCategory.length; i++) {
1271
+ sameCategory[i].classList.remove('selected');
1272
+ }
1273
 
1274
  // ํ˜„์žฌ ์นด๋“œ ์„ ํƒ
1275
  card.classList.add('selected');