bitlo commited on
Commit
7c7c910
·
verified ·
1 Parent(s): 80cb973

Не отображется меню

Browse files
Files changed (1) hide show
  1. components/navbar.js +25 -7
components/navbar.js CHANGED
@@ -2,7 +2,17 @@ class CustomNavbar extends HTMLElement {
2
  connectedCallback() {
3
  this.attachShadow({ mode: 'open' });
4
  this.shadowRoot.innerHTML = `
5
- <style>
 
 
 
 
 
 
 
 
 
 
6
  :host {
7
  display: block;
8
  }
@@ -18,11 +28,16 @@ class CustomNavbar extends HTMLElement {
18
  overflow: hidden;
19
  transition: max-height 0.3s ease-out;
20
  background-color: white;
 
 
 
 
21
  }
22
  .mobile-menu.open {
23
  max-height: 500px;
 
24
  }
25
- @media (min-width: 768px) {
26
  .mobile-menu {
27
  max-height: none !important;
28
  background-color: transparent;
@@ -39,8 +54,12 @@ class CustomNavbar extends HTMLElement {
39
  <a href="/" class="text-2xl font-bold text-primary" style="z-index: 100;">TOPTERA</a>
40
  <!-- Mobile menu button -->
41
  <button id="mobile-menu-button" class="md:hidden focus:outline-none">
42
- <i data-feather="menu"></i>
43
- </button>
 
 
 
 
44
 
45
  <!-- Desktop menu -->
46
  <div class="hidden md:flex space-x-8">
@@ -49,10 +68,9 @@ class CustomNavbar extends HTMLElement {
49
  <a href="#cases" class="text-zinc-700 hover:text-primary transition duration-300">Кейсы</a>
50
  <a href="/seo-spetsialist-seo-optimizator.html" class="text-zinc-700 hover:text-primary transition duration-300">Вакансии</a>
51
  </div>
52
-
53
  <!-- Mobile menu -->
54
- <div id="mobile-menu" class="mobile-menu md:hidden w-full absolute left-0 top-full shadow-lg">
55
- <div class="container mx-auto px-6 py-4 flex flex-col space-y-4">
56
  <a href="#problem" class="text-zinc-700 hover:text-primary transition duration-300 py-2">Проблемы</a>
57
  <a href="#process" class="text-zinc-700 hover:text-primary transition duration-300 py-2">Процесс</a>
58
  <a href="#cases" class="text-zinc-700 hover:text-primary transition duration-300 py-2">Кейсы</a>
 
2
  connectedCallback() {
3
  this.attachShadow({ mode: 'open' });
4
  this.shadowRoot.innerHTML = `
5
+ <script>
6
+ document.addEventListener('DOMContentLoaded', () => {
7
+ const menuButton = this.shadowRoot.getElementById('mobile-menu-button');
8
+ const mobileMenu = this.shadowRoot.getElementById('mobile-menu');
9
+
10
+ menuButton.addEventListener('click', () => {
11
+ mobileMenu.classList.toggle('open');
12
+ });
13
+ });
14
+ </script>
15
+ <style>
16
  :host {
17
  display: block;
18
  }
 
28
  overflow: hidden;
29
  transition: max-height 0.3s ease-out;
30
  background-color: white;
31
+ width: 100%;
32
+ position: absolute;
33
+ left: 0;
34
+ top: 100%;
35
  }
36
  .mobile-menu.open {
37
  max-height: 500px;
38
+ display: block;
39
  }
40
+ @media (min-width: 768px) {
41
  .mobile-menu {
42
  max-height: none !important;
43
  background-color: transparent;
 
54
  <a href="/" class="text-2xl font-bold text-primary" style="z-index: 100;">TOPTERA</a>
55
  <!-- Mobile menu button -->
56
  <button id="mobile-menu-button" class="md:hidden focus:outline-none">
57
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
58
+ <line x1="3" y1="12" x2="21" y2="12"></line>
59
+ <line x1="3" y1="6" x2="21" y2="6"></line>
60
+ <line x1="3" y1="18" x2="21" y2="18"></line>
61
+ </svg>
62
+ </button>
63
 
64
  <!-- Desktop menu -->
65
  <div class="hidden md:flex space-x-8">
 
68
  <a href="#cases" class="text-zinc-700 hover:text-primary transition duration-300">Кейсы</a>
69
  <a href="/seo-spetsialist-seo-optimizator.html" class="text-zinc-700 hover:text-primary transition duration-300">Вакансии</a>
70
  </div>
 
71
  <!-- Mobile menu -->
72
+ <div id="mobile-menu" class="mobile-menu md:hidden shadow-lg">
73
+ <div class="container mx-auto px-6 py-4 flex flex-col space-y-4">
74
  <a href="#problem" class="text-zinc-700 hover:text-primary transition duration-300 py-2">Проблемы</a>
75
  <a href="#process" class="text-zinc-700 hover:text-primary transition duration-300 py-2">Процесс</a>
76
  <a href="#cases" class="text-zinc-700 hover:text-primary transition duration-300 py-2">Кейсы</a>