add plan to form

This commit is contained in:
Raitraut
2026-03-13 15:49:37 +01:00
parent c2726771d2
commit 325135065e
3 changed files with 38 additions and 6 deletions

View File

@@ -76,8 +76,25 @@ function isValidEmail(email) {
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
}
// ===== Smooth Scroll for "Objednat se" buttons =====
// ===== Plan selection from pricing buttons =====
const formPlan = document.getElementById('formPlan');
document.querySelectorAll('.plan-btn').forEach(btn => {
btn.addEventListener('click', (e) => {
e.preventDefault();
const plan = btn.getAttribute('data-plan');
if (formPlan && plan) {
formPlan.value = plan;
formPlan.parentElement.classList.add('highlight-field');
setTimeout(() => formPlan.parentElement.classList.remove('highlight-field'), 1500);
}
document.getElementById('kontakt').scrollIntoView({ behavior: 'smooth' });
});
});
// ===== Smooth Scroll for anchor links =====
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
if (anchor.classList.contains('plan-btn')) return;
anchor.addEventListener('click', (e) => {
const target = document.querySelector(anchor.getAttribute('href'));
if (target) {