Yang2001 commited on
Commit
c1ef43c
·
1 Parent(s): d53464a

feat: add mouse wheel horizontal scroll to examples gallery, hide scrollbar

Browse files
Files changed (1) hide show
  1. index.html +25 -1
index.html CHANGED
@@ -423,8 +423,15 @@
423
  display: flex;
424
  flex-wrap: nowrap;
425
  gap: 1rem;
426
- overflow: hidden;
 
427
  padding-bottom: 0.5rem;
 
 
 
 
 
 
428
  }
429
  .examples-track {
430
  display: flex;
@@ -1195,6 +1202,23 @@
1195
  setTimeout(() => t.style.display = 'none', 3000);
1196
  }
1197
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1198
  init();
1199
  </script>
1200
  </body>
 
423
  display: flex;
424
  flex-wrap: nowrap;
425
  gap: 1rem;
426
+ overflow-x: auto;
427
+ overflow-y: hidden;
428
  padding-bottom: 0.5rem;
429
+ scroll-behavior: smooth;
430
+ scrollbar-width: none;
431
+ -ms-overflow-style: none;
432
+ }
433
+ .examples-grid::-webkit-scrollbar {
434
+ display: none;
435
  }
436
  .examples-track {
437
  display: flex;
 
1202
  setTimeout(() => t.style.display = 'none', 3000);
1203
  }
1204
 
1205
+ // Enable mouse wheel horizontal scroll for examples gallery
1206
+ const exGrid = document.getElementById('examples-grid');
1207
+ let wheelTimeout = null;
1208
+ exGrid.addEventListener('wheel', (e) => {
1209
+ if (Math.abs(e.deltaY) > 0) {
1210
+ e.preventDefault();
1211
+ exGrid.scrollLeft += e.deltaY;
1212
+ // Pause animation while scrolling
1213
+ const track = exGrid.querySelector('.examples-track');
1214
+ if (track) track.style.animationPlayState = 'paused';
1215
+ clearTimeout(wheelTimeout);
1216
+ wheelTimeout = setTimeout(() => {
1217
+ if (track) track.style.animationPlayState = 'running';
1218
+ }, 1500);
1219
+ }
1220
+ }, { passive: false });
1221
+
1222
  init();
1223
  </script>
1224
  </body>