Ar4ikov commited on
Commit
0ac0ea7
·
verified ·
1 Parent(s): 4a3309e

Чет кал какой-то переключение темы. И ты не добавил liquid glass (жидкое стекло) из MacOS 26.

Browse files
Files changed (1) hide show
  1. index.html +58 -48
index.html CHANGED
@@ -34,6 +34,16 @@
34
  }
35
  </script>
36
  <style>
 
 
 
 
 
 
 
 
 
 
37
  .vanta-bg {
38
  position: absolute;
39
  top: 0;
@@ -43,17 +53,14 @@
43
  z-index: -1;
44
  }
45
  .glass-effect {
 
 
 
 
46
  backdrop-filter: blur(16px) saturate(180%);
47
  -webkit-backdrop-filter: blur(16px) saturate(180%);
48
- background-color: rgba(255, 255, 255, 0.75);
49
- border-radius: 12px;
50
- border: 1px solid rgba(209, 213, 219, 0.3);
51
  }
52
- .dark .glass-effect {
53
- background-color: rgba(17, 24, 39, 0.75);
54
- border: 1px solid rgba(255, 255, 255, 0.125);
55
- }
56
- .dark {
57
  background-color: #111827;
58
  color: #f3f4f6;
59
  }
@@ -454,75 +461,78 @@ Write. Collaborate.
454
  });
455
  // Initialize Feather Icons
456
  feather.replace();
457
-
458
- // Theme switcher
459
  const themeToggle = document.getElementById('theme-toggle');
460
  const themeIcon = document.getElementById('theme-icon');
461
  const prefersDarkScheme = window.matchMedia('(prefers-color-scheme: dark)');
462
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
463
  // Check for saved theme preference or use system preference
464
  const currentTheme = localStorage.getItem('theme');
465
  if (currentTheme === 'dark' || (!currentTheme && prefersDarkScheme.matches)) {
466
- document.documentElement.classList.add('dark');
467
- themeIcon.setAttribute('data-feather', 'sun');
468
- feather.replace();
469
  } else {
470
- document.documentElement.classList.remove('dark');
471
- themeIcon.setAttribute('data-feather', 'moon');
472
- feather.replace();
473
  }
474
 
475
- // Toggle theme
476
  themeToggle.addEventListener('click', function() {
477
  const html = document.documentElement;
478
- if (html.classList.contains('dark')) {
479
- html.classList.remove('dark');
480
- localStorage.setItem('theme', 'light');
481
- themeIcon.setAttribute('data-feather', 'moon');
482
- } else {
483
- html.classList.add('dark');
484
- localStorage.setItem('theme', 'dark');
485
- themeIcon.setAttribute('data-feather', 'sun');
486
- }
487
- feather.replace();
488
  });
489
 
490
  // Listen for system theme changes
491
  prefersDarkScheme.addListener((e) => {
492
  if (!localStorage.getItem('theme')) {
493
- if (e.matches) {
494
- document.documentElement.classList.add('dark');
495
- themeIcon.setAttribute('data-feather', 'sun');
496
- } else {
497
- document.documentElement.classList.remove('dark');
498
- themeIcon.setAttribute('data-feather', 'moon');
499
- }
500
- feather.replace();
501
  }
502
  });
503
- // Smooth scrolling for navigation links
504
  document.querySelectorAll('a[href^="#"]').forEach(anchor => {
505
- anchor.addEventListener('click', function (e) {
506
  e.preventDefault();
507
- const target = document.querySelector(this.getAttribute('href'));
 
508
  if (target) {
509
- target.scrollIntoView({
510
- behavior: 'smooth',
511
- block: 'start'
 
 
512
  });
513
  }
514
- });
515
  });
516
-
517
- // Add scroll effect to navbar
518
  window.addEventListener('scroll', function() {
519
  const nav = document.querySelector('nav');
520
- if (window.scrollY > 100) {
521
- nav.classList.add('bg-white', 'shadow-lg');
 
 
522
  } else {
523
- nav.classList.remove('shadow-lg');
 
 
524
  }
525
  });
526
- </script>
527
  </body>
528
  </html>
 
34
  }
35
  </script>
36
  <style>
37
+ :root {
38
+ --glass-bg: rgba(255, 255, 255, 0.75);
39
+ --glass-border: rgba(209, 213, 219, 0.3);
40
+ --glass-shadow: rgba(0, 0, 0, 0.1);
41
+ }
42
+ .dark {
43
+ --glass-bg: rgba(17, 24, 39, 0.75);
44
+ --glass-border: rgba(255, 255, 255, 0.125);
45
+ --glass-shadow: rgba(0, 0, 0, 0.25);
46
+ }
47
  .vanta-bg {
48
  position: absolute;
49
  top: 0;
 
53
  z-index: -1;
54
  }
55
  .glass-effect {
56
+ background: var(--glass-bg);
57
+ border-radius: 16px;
58
+ border: 1px solid var(--glass-border);
59
+ box-shadow: 0 4px 30px var(--glass-shadow);
60
  backdrop-filter: blur(16px) saturate(180%);
61
  -webkit-backdrop-filter: blur(16px) saturate(180%);
 
 
 
62
  }
63
+ .dark {
 
 
 
 
64
  background-color: #111827;
65
  color: #f3f4f6;
66
  }
 
461
  });
462
  // Initialize Feather Icons
463
  feather.replace();
464
+ // Theme switcher with smooth transition
 
465
  const themeToggle = document.getElementById('theme-toggle');
466
  const themeIcon = document.getElementById('theme-icon');
467
  const prefersDarkScheme = window.matchMedia('(prefers-color-scheme: dark)');
468
 
469
+ // Apply theme with transition
470
+ function applyTheme(isDark) {
471
+ document.documentElement.style.transition = 'all 0.5s ease';
472
+ if (isDark) {
473
+ document.documentElement.classList.add('dark');
474
+ themeIcon.setAttribute('data-feather', 'sun');
475
+ } else {
476
+ document.documentElement.classList.remove('dark');
477
+ themeIcon.setAttribute('data-feather', 'moon');
478
+ }
479
+ feather.replace();
480
+ setTimeout(() => {
481
+ document.documentElement.style.transition = '';
482
+ }, 500);
483
+ }
484
+
485
  // Check for saved theme preference or use system preference
486
  const currentTheme = localStorage.getItem('theme');
487
  if (currentTheme === 'dark' || (!currentTheme && prefersDarkScheme.matches)) {
488
+ applyTheme(true);
 
 
489
  } else {
490
+ applyTheme(false);
 
 
491
  }
492
 
493
+ // Toggle theme with animation
494
  themeToggle.addEventListener('click', function() {
495
  const html = document.documentElement;
496
+ const isDark = !html.classList.contains('dark');
497
+ localStorage.setItem('theme', isDark ? 'dark' : 'light');
498
+ applyTheme(isDark);
 
 
 
 
 
 
 
499
  });
500
 
501
  // Listen for system theme changes
502
  prefersDarkScheme.addListener((e) => {
503
  if (!localStorage.getItem('theme')) {
504
+ applyTheme(e.matches);
 
 
 
 
 
 
 
505
  }
506
  });
507
+ // Enhanced smooth scrolling with offset for fixed header
508
  document.querySelectorAll('a[href^="#"]').forEach(anchor => {
509
+ anchor.addEventListener('click', function (e) {
510
  e.preventDefault();
511
+ const targetId = this.getAttribute('href');
512
+ const target = document.querySelector(targetId);
513
  if (target) {
514
+ const headerHeight = document.querySelector('nav').offsetHeight;
515
+ const targetPosition = target.getBoundingClientRect().top + window.pageYOffset - headerHeight;
516
+ window.scrollTo({
517
+ top: targetPosition,
518
+ behavior: 'smooth'
519
  });
520
  }
521
+ });
522
  });
523
+ // Enhanced navbar scroll effect with glass morphism
 
524
  window.addEventListener('scroll', function() {
525
  const nav = document.querySelector('nav');
526
+ if (window.scrollY > 20) {
527
+ nav.classList.add('bg-white/80', 'dark:bg-gray-900/80', 'shadow-lg', 'backdrop-blur-md');
528
+ nav.style.backdropFilter = 'blur(8px)';
529
+ nav.style.webkitBackdropFilter = 'blur(8px)';
530
  } else {
531
+ nav.classList.remove('shadow-lg', 'backdrop-blur-md');
532
+ nav.style.backdropFilter = '';
533
+ nav.style.webkitBackdropFilter = '';
534
  }
535
  });
536
+ </script>
537
  </body>
538
  </html>