SamiKoen commited on
Commit
0482263
·
1 Parent(s): 2356ad2

Replace thumbnails with overlay arrow nav; click image to pause auto-rotation

Browse files
Files changed (1) hide show
  1. static/index.html +49 -77
static/index.html CHANGED
@@ -88,17 +88,17 @@
88
  text-transform: uppercase;
89
  }
90
 
91
- /* Cift monitor sahnesi — flex, aralarinda rail'lere yetecek bosluk */
92
  .stage {
93
  display: flex;
94
  justify-content: center;
95
  align-items: flex-start;
96
  flex-wrap: wrap;
97
- gap: 160px; /* sag monitorun rail'leri bu bosluga oturur */
98
  }
99
  .monitor {
100
  width: 100%;
101
- max-width: 520px;
102
  position: relative;
103
  }
104
 
@@ -155,50 +155,33 @@
155
  text-align: center;
156
  padding: 0 24px;
157
  }
158
- /* Thumbnail ray'lerisag monitorun YANINDA, monitor disinda absolute,
159
- monitor genisligi degismez (sol monitorle ayni kalir) */
160
- .monitor.with-rails { position: relative; }
161
- .thumb-rail {
162
  position: absolute;
163
- top: 14px;
164
- bottom: 14px;
165
- width: 64px;
 
 
 
 
 
 
 
166
  display: flex;
167
- flex-direction: column;
168
- gap: 8px;
169
- pointer-events: auto;
170
- }
171
- .thumb-rail.left { right: calc(100% + 10px); }
172
- .thumb-rail.right { left: calc(100% + 10px); }
173
- .thumb-rail button {
174
- all: unset;
175
- width: 100%;
176
- aspect-ratio: 4 / 3; /* yatay (landscape) thumbnail */
177
- background: #ffffff center / cover no-repeat;
178
- border: 2px solid rgba(0,0,0,0.08);
179
- border-radius: 6px;
180
  cursor: pointer;
 
181
  transition: all 0.15s;
182
- box-shadow: 0 2px 6px rgba(0,0,0,0.06);
183
- }
184
- .thumb-rail button:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0,0,0,0.12); }
185
- .thumb-rail button.active { border-color: var(--trek-red); box-shadow: 0 0 0 1px var(--trek-red), 0 4px 10px rgba(0,0,0,0.12); }
186
- @media (max-width: 1100px) {
187
- .thumb-rail { width: 64px; }
188
- }
189
- @media (max-width: 900px) {
190
- /* mobilde rays alt alta giriyor — saga ve sola degil, monitor altina */
191
- .monitor.with-rails .thumb-rail {
192
- position: static;
193
- flex-direction: row;
194
- width: auto;
195
- height: 56px;
196
- margin-top: 10px;
197
- gap: 8px;
198
- overflow-x: auto;
199
- }
200
- .monitor.with-rails .thumb-rail button { width: 70px; flex-shrink: 0; }
201
- }
202
  .screen.left.active {
203
  box-shadow:
204
  0 0 0 2px var(--trek-red),
@@ -363,16 +346,16 @@
363
  </div>
364
  <div class="stand"><div class="neck"></div><div class="base"></div></div>
365
  </div>
366
- <div class="monitor with-rails">
367
- <div class="thumb-rail left" id="thumbsLeft"></div>
368
  <div class="screen right" id="rightScreen">
369
  <div class="screen-inner">
370
  <div class="empty" id="productEmpty">Henüz Ürün Yok</div>
371
  <img id="productImg" alt="" style="display:none;" />
 
 
372
  </div>
373
  </div>
374
  <div class="stand"><div class="neck"></div><div class="base"></div></div>
375
- <div class="thumb-rail right" id="thumbsRight"></div>
376
  </div>
377
  </div>
378
 
@@ -525,29 +508,32 @@ async function connect() {
525
  let _galleryImages = [];
526
  let _galleryIdx = 0;
527
  let _galleryTimer = null;
 
528
 
529
  function setMainImage(idx) {
530
  if (!_galleryImages.length) return;
531
  _galleryIdx = (idx + _galleryImages.length) % _galleryImages.length;
532
- const img = $('productImg');
533
- img.src = _galleryImages[_galleryIdx];
534
- // Iki rail'deki thumb active sınıfını güncelle
535
- document.querySelectorAll('.thumb-rail button').forEach(b => {
536
- b.classList.toggle('active', parseInt(b.dataset.idx) === _galleryIdx);
537
- });
538
  }
539
 
540
  function startGalleryRotation() {
541
- if (_galleryTimer) clearInterval(_galleryTimer);
542
  if (_galleryImages.length <= 1) return;
543
- _galleryTimer = setInterval(() => setMainImage(_galleryIdx + 1), 4000);
 
 
 
 
 
 
 
544
  }
545
 
546
  function showProduct(p) {
547
  if (!p || !p.image) return;
548
- // Galeri: images[] varsa onu kullan, yoksa tek image
549
  _galleryImages = (Array.isArray(p.images) && p.images.length) ? p.images : [p.image];
550
  _galleryIdx = 0;
 
551
 
552
  const img = $('productImg');
553
  img.onerror = () => { img.style.display = 'none'; $('productEmpty').style.display = 'flex'; };
@@ -555,29 +541,9 @@ function showProduct(p) {
555
  img.src = _galleryImages[0];
556
  img.alt = p.name || '';
557
 
558
- // Thumbnail rails — sag ve sol, dengeli dagit (8 4+4, 5 → 3+2 vs.)
559
- const left = $('thumbsLeft');
560
- const right = $('thumbsRight');
561
- left.innerHTML = '';
562
- right.innerHTML = '';
563
- if (_galleryImages.length > 1) {
564
- const half = Math.ceil(_galleryImages.length / 2);
565
- const leftImgs = _galleryImages.slice(0, half);
566
- const rightImgs = _galleryImages.slice(half);
567
- const makeBtn = (url, i) =>
568
- `<button data-idx="${i}" style="background-image:url('${url}')" aria-label="Resim ${i+1}"></button>`;
569
- left.innerHTML = leftImgs.map((u, i) => makeBtn(u, i)).join('');
570
- right.innerHTML = rightImgs.map((u, i) => makeBtn(u, i + half)).join('');
571
- document.querySelectorAll('.thumb-rail button').forEach(b => {
572
- b.onclick = () => { setMainImage(parseInt(b.dataset.idx)); startGalleryRotation(); };
573
- });
574
- setMainImage(0);
575
- startGalleryRotation();
576
- } else {
577
- if (_galleryTimer) { clearInterval(_galleryTimer); _galleryTimer = null; }
578
- }
579
 
580
- // Alt bant: urun adi + link
581
  const linkHtml = p.link ? `<a class="plink" href="${p.link}" target="_blank" rel="noopener">Ürünü Gör</a>` : '';
582
  $('productInfo').innerHTML = `
583
  <div class="pname">${p.name || ''}</div>
@@ -585,6 +551,12 @@ function showProduct(p) {
585
  `;
586
  }
587
 
 
 
 
 
 
 
588
  function handleEvent(evt) {
589
  switch (evt.type) {
590
  case 'product.show':
 
88
  text-transform: uppercase;
89
  }
90
 
91
+ /* Cift monitor sahnesi — buyuk monitorler, yan yana */
92
  .stage {
93
  display: flex;
94
  justify-content: center;
95
  align-items: flex-start;
96
  flex-wrap: wrap;
97
+ gap: 40px;
98
  }
99
  .monitor {
100
  width: 100%;
101
+ max-width: 720px;
102
  position: relative;
103
  }
104
 
 
155
  text-align: center;
156
  padding: 0 24px;
157
  }
158
+ /* Galeri ok butonlari monitor icinde, sag/sol kenar */
159
+ .nav-arrow {
 
 
160
  position: absolute;
161
+ top: 50%;
162
+ transform: translateY(-50%);
163
+ width: 44px;
164
+ height: 44px;
165
+ border-radius: 50%;
166
+ background: rgba(0,0,0,0.55);
167
+ color: #fff;
168
+ border: none;
169
+ font-size: 22px;
170
+ line-height: 1;
171
  display: flex;
172
+ align-items: center;
173
+ justify-content: center;
 
 
 
 
 
 
 
 
 
 
 
174
  cursor: pointer;
175
+ z-index: 3;
176
  transition: all 0.15s;
177
+ backdrop-filter: blur(4px);
178
+ opacity: 0;
179
+ }
180
+ .screen.right:hover .nav-arrow { opacity: 1; }
181
+ .nav-arrow:hover { background: rgba(0,0,0,0.75); transform: translateY(-50%) scale(1.06); }
182
+ .nav-arrow.prev { left: 14px; }
183
+ .nav-arrow.next { right: 14px; }
184
+ .screen.right .screen-inner img { cursor: pointer; }
 
 
 
 
 
 
 
 
 
 
 
 
185
  .screen.left.active {
186
  box-shadow:
187
  0 0 0 2px var(--trek-red),
 
346
  </div>
347
  <div class="stand"><div class="neck"></div><div class="base"></div></div>
348
  </div>
349
+ <div class="monitor">
 
350
  <div class="screen right" id="rightScreen">
351
  <div class="screen-inner">
352
  <div class="empty" id="productEmpty">Henüz Ürün Yok</div>
353
  <img id="productImg" alt="" style="display:none;" />
354
+ <button class="nav-arrow prev" id="navPrev" aria-label="Önceki resim">‹</button>
355
+ <button class="nav-arrow next" id="navNext" aria-label="Sonraki resim">›</button>
356
  </div>
357
  </div>
358
  <div class="stand"><div class="neck"></div><div class="base"></div></div>
 
359
  </div>
360
  </div>
361
 
 
508
  let _galleryImages = [];
509
  let _galleryIdx = 0;
510
  let _galleryTimer = null;
511
+ let _galleryPaused = false;
512
 
513
  function setMainImage(idx) {
514
  if (!_galleryImages.length) return;
515
  _galleryIdx = (idx + _galleryImages.length) % _galleryImages.length;
516
+ $('productImg').src = _galleryImages[_galleryIdx];
 
 
 
 
 
517
  }
518
 
519
  function startGalleryRotation() {
520
+ stopGalleryRotation();
521
  if (_galleryImages.length <= 1) return;
522
+ _galleryPaused = false;
523
+ _galleryTimer = setInterval(() => {
524
+ if (!_galleryPaused) setMainImage(_galleryIdx + 1);
525
+ }, 4000);
526
+ }
527
+
528
+ function stopGalleryRotation() {
529
+ if (_galleryTimer) { clearInterval(_galleryTimer); _galleryTimer = null; }
530
  }
531
 
532
  function showProduct(p) {
533
  if (!p || !p.image) return;
 
534
  _galleryImages = (Array.isArray(p.images) && p.images.length) ? p.images : [p.image];
535
  _galleryIdx = 0;
536
+ _galleryPaused = false;
537
 
538
  const img = $('productImg');
539
  img.onerror = () => { img.style.display = 'none'; $('productEmpty').style.display = 'flex'; };
 
541
  img.src = _galleryImages[0];
542
  img.alt = p.name || '';
543
 
544
+ if (_galleryImages.length > 1) startGalleryRotation();
545
+ else stopGalleryRotation();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
546
 
 
547
  const linkHtml = p.link ? `<a class="plink" href="${p.link}" target="_blank" rel="noopener">Ürünü Gör</a>` : '';
548
  $('productInfo').innerHTML = `
549
  <div class="pname">${p.name || ''}</div>
 
551
  `;
552
  }
553
 
554
+ // Ok butonlari — tiklayinca otomatik akis devam etsin
555
+ $('navPrev').onclick = () => { setMainImage(_galleryIdx - 1); startGalleryRotation(); };
556
+ $('navNext').onclick = () => { setMainImage(_galleryIdx + 1); startGalleryRotation(); };
557
+ // Resme tiklayinca duraklat / devam
558
+ $('productImg').onclick = () => { _galleryPaused = !_galleryPaused; };
559
+
560
  function handleEvent(evt) {
561
  switch (evt.type) {
562
  case 'product.show':