Pavelm777 commited on
Commit
8e71747
·
verified ·
1 Parent(s): 0d2ee7e

создай внутри секции чекбокс при нажатии на который открывается модальное окно в котором запроси фимилию, имя , отчество и номер телефона

Browse files
Files changed (2) hide show
  1. index.html +107 -3
  2. style.css +36 -1
index.html CHANGED
@@ -512,12 +512,108 @@ document.getElementById('heroScrollBtn').addEventListener('click', function() {
512
  </div>
513
  </section>
514
  <section class="py-12 bg-gradient-to-r from-primary to-secondary">
515
- <br><br>
 
 
 
 
 
 
 
516
 
517
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
518
  </section>
519
- </main>
520
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
521
  <script>
522
  // Hero scroll buttons
523
  document.getElementById('heroScrollBtn').addEventListener('click', () => {
@@ -532,6 +628,14 @@ document.getElementById('heroScrollBtn').addEventListener('click', function() {
532
  behavior: 'smooth'
533
  });
534
  });
 
 
 
 
 
 
 
 
535
  // Mobile menu toggle
536
  const mobileMenuButton = document.getElementById('mobile-menu-button');
537
  const mobileMenu = document.getElementById('mobile-menu');
 
512
  </div>
513
  </section>
514
  <section class="py-12 bg-gradient-to-r from-primary to-secondary">
515
+ <div class="container mx-auto px-4 text-center">
516
+ <div class="inline-flex items-center bg-white rounded-full px-8 py-3 shadow-lg cursor-pointer hovered-element" id="contactTrigger">
517
+ <input type="checkbox" id="contactCheckbox" class="form-checkbox h-5 w-5 text-primary mr-2">
518
+ <label for="contactCheckbox" class="text-lg font-medium text-gray-700 cursor-pointer">
519
+ Оставить заявку на консультацию
520
+ </label>
521
+ </div>
522
+ </div>
523
 
524
+ <!-- Modal -->
525
+ <div id="contactModal" class="fixed inset-0 z-50 hidden flex items-center justify-center bg-black bg-opacity-50">
526
+ <div class="bg-white rounded-lg p-8 max-w-md w-full mx-4">
527
+ <div class="flex justify-between items-center mb-6">
528
+ <h3 class="text-2xl font-bold text-secondary">Заявка на консультацию</h3>
529
+ <button id="closeModal" class="text-gray-500 hover:text-gray-700">
530
+ <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
531
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
532
+ </svg>
533
+ </button>
534
+ </div>
535
+
536
+ <form id="contactForm">
537
+ <div class="mb-4">
538
+ <label for="lastName" class="block text-gray-700 mb-2">Фамилия</label>
539
+ <input type="text" id="lastName" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary" required>
540
+ </div>
541
+
542
+ <div class="mb-4">
543
+ <label for="firstName" class="block text-gray-700 mb-2">Имя</label>
544
+ <input type="text" id="firstName" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary" required>
545
+ </div>
546
+
547
+ <div class="mb-4">
548
+ <label for="middleName" class="block text-gray-700 mb-2">Отчество</label>
549
+ <input type="text" id="middleName" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary">
550
+ </div>
551
+
552
+ <div class="mb-6">
553
+ <label for="phone" class="block text-gray-700 mb-2">Телефон</label>
554
+ <input type="tel" id="phone" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary" placeholder="+7 (___) ___-__-__" required>
555
+ </div>
556
+
557
+ <div class="flex items-center mb-4">
558
+ <input type="checkbox" id="privacyCheckbox" class="form-checkbox h-5 w-5 text-primary mr-2" required>
559
+ <label for="privacyCheckbox" class="text-gray-600 text-sm">
560
+ Я согласен на обработку персональных данных
561
+ </label>
562
+ </div>
563
+
564
+ <button type="submit" class="w-full bg-primary hover:bg-secondary text-white font-bold py-3 px-4 rounded-md transition duration-300">
565
+ Отправить заявку
566
+ </button>
567
+ </form>
568
+ </div>
569
+ </div>
570
  </section>
 
571
 
572
+ <script>
573
+ // Modal functionality
574
+ const contactTrigger = document.getElementById('contactTrigger');
575
+ const contactCheckbox = document.getElementById('contactCheckbox');
576
+ const contactModal = document.getElementById('contactModal');
577
+ const closeModal = document.getElementById('closeModal');
578
+ const contactForm = document.getElementById('contactForm');
579
+
580
+ contactTrigger.addEventListener('click', () => {
581
+ contactCheckbox.checked = !contactCheckbox.checked;
582
+ contactModal.classList.toggle('hidden', !contactCheckbox.checked);
583
+ });
584
+
585
+ closeModal.addEventListener('click', () => {
586
+ contactCheckbox.checked = false;
587
+ contactModal.classList.add('hidden');
588
+ });
589
+
590
+ // Phone input mask
591
+ const phoneInput = document.getElementById('phone');
592
+ phoneInput.addEventListener('input', function(e) {
593
+ let x = e.target.value.replace(/\D/g, '').match(/(\d{0,1})(\d{0,3})(\d{0,3})(\d{0,2})(\d{0,2})/);
594
+ e.target.value = !x[2] ? x[1] : '+7 ' + x[2] + (x[3] ? '-' + x[3] : '') + (x[4] ? '-' + x[4] : '') + (x[5] ? '-' + x[5] : '');
595
+ });
596
+
597
+ // Form submission
598
+ contactForm.addEventListener('submit', function(e) {
599
+ e.preventDefault();
600
+
601
+ const formData = {
602
+ lastName: document.getElementById('lastName').value,
603
+ firstName: document.getElementById('firstName').value,
604
+ middleName: document.getElementById('middleName').value,
605
+ phone: document.getElementById('phone').value
606
+ };
607
+
608
+ console.log('Form submitted:', formData);
609
+ alert('Спасибо! Ваши данные успешно отправлены. Мы свяжемся с вами в ближайшее время.');
610
+
611
+ contactCheckbox.checked = false;
612
+ contactModal.classList.add('hidden');
613
+ contactForm.reset();
614
+ });
615
+ </script>
616
+ </main>
617
  <script>
618
  // Hero scroll buttons
619
  document.getElementById('heroScrollBtn').addEventListener('click', () => {
 
628
  behavior: 'smooth'
629
  });
630
  });
631
+
632
+ // Mobile menu toggle
633
+ const mobileMenuButton = document.getElementById('mobile-menu-button');
634
+ const mobileMenu = document.getElementById('mobile-menu');
635
+
636
+ mobileMenuButton.addEventListener('click', () => {
637
+ mobileMenu.classList.toggle('open');
638
+ });
639
  // Mobile menu toggle
640
  const mobileMenuButton = document.getElementById('mobile-menu-button');
641
  const mobileMenu = document.getElementById('mobile-menu');
style.css CHANGED
@@ -18,10 +18,45 @@ body {
18
  transform: translateY(-3px);
19
  }
20
  }
21
-
22
  .animate-bounce {
23
  animation: bounce 2s infinite;
24
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  h1 {
26
  font-size: 16px;
27
  margin-top: 0;
 
18
  transform: translateY(-3px);
19
  }
20
  }
 
21
  .animate-bounce {
22
  animation: bounce 2s infinite;
23
  }
24
+
25
+ .form-checkbox {
26
+ -webkit-appearance: none;
27
+ -moz-appearance: none;
28
+ appearance: none;
29
+ border: 2px solid #0d9488;
30
+ border-radius: 4px;
31
+ width: 20px;
32
+ height: 20px;
33
+ cursor: pointer;
34
+ position: relative;
35
+ transition: all 0.2s ease;
36
+ }
37
+
38
+ .form-checkbox:checked {
39
+ background-color: #0d9488;
40
+ }
41
+
42
+ .form-checkbox:checked::after {
43
+ content: '✓';
44
+ position: absolute;
45
+ color: white;
46
+ font-size: 14px;
47
+ top: 50%;
48
+ left: 50%;
49
+ transform: translate(-50%, -50%);
50
+ }
51
+
52
+ #contactModal {
53
+ transition: opacity 0.3s ease;
54
+ }
55
+
56
+ #contactModal.hidden {
57
+ opacity: 0;
58
+ pointer-events: none;
59
+ }
60
  h1 {
61
  font-size: 16px;
62
  margin-top: 0;