File size: 2,914 Bytes
f3e9dac
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
document.addEventListener('DOMContentLoaded', function() {
    // Mobile menu toggle
    const mobileMenuButton = document.querySelector('header button');
    const mobileMenu = document.createElement('div');
    mobileMenu.className = 'mobile-menu hidden bg-white w-full absolute left-0 top-full shadow-lg z-50';
    
    const navItems = [
        {text: 'Главная', href: '#'},
        {text: 'Услуги', href: '#'},
        {text: 'Специалисты', href: '#'},
        {text: 'Цены', href: '#'},
        {text: 'О нас', href: '#'},
        {text: 'Контакты', href: '#'},
        {text: 'Блог', href: '#'}
    ];
    
    const navList = document.createElement('ul');
    navList.className = 'py-4';
    
    navItems.forEach(item => {
        const li = document.createElement('li');
        const a = document.createElement('a');
        a.href = item.href;
        a.className = 'block px-6 py-2 hover:bg-gray-100 font-medium';
        a.textContent = item.text;
        li.appendChild(a);
        navList.appendChild(li);
    });
    
    mobileMenu.appendChild(navList);
    document.querySelector('header').appendChild(mobileMenu);
    
    mobileMenuButton.addEventListener('click', function() {
        mobileMenu.classList.toggle('hidden');
        feather.replace();
    });
    
    // Smooth scrolling for anchor links
    document.querySelectorAll('a[href^="#"]').forEach(anchor => {
        anchor.addEventListener('click', function(e) {
            e.preventDefault();
            
            const targetId = this.getAttribute('href');
            if (targetId === '#') return;
            
            const targetElement = document.querySelector(targetId);
            if (targetElement) {
                targetElement.scrollIntoView({
                    behavior: 'smooth'
                });
            }
        });
    });
    
    // Form submission
    const appointmentForm = document.querySelector('form');
    if (appointmentForm) {
        appointmentForm.addEventListener('submit', function(e) {
            e.preventDefault();
            
            // Here you would normally send the form data to the server
            // For demo purposes, we'll just show an alert
            alert('Спасибо! Ваша заявка отправлена. Мы свяжемся с вами в ближайшее время.');
            this.reset();
        });
    }
    
    // Add hover effects to elements
    document.querySelectorAll('.btn-hover').forEach(btn => {
        btn.addEventListener('mouseenter', function() {
            this.classList.add('transform', '-translate-y-1', 'shadow-md');
        });
        
        btn.addEventListener('mouseleave', function() {
            this.classList.remove('transform', '-translate-y-1', 'shadow-md');
        });
    });
    
    // Initialize Feather Icons
    feather.replace();
});