add plan to form
This commit is contained in:
19
js/main.js
19
js/main.js
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user