Spaces:
Running

cleanlanding / script.js
Paurakh04's picture
build a landing page, focus on creating a clean and straightforward layout that clearly conveys your message or offer. Consider using a minimal color palette with solid colors instead of gradients. Choose fonts that are easy to read and align with your brand’s identity. Incorporate high-quality images or graphics that support your content without being overwhelming. Make sure to include a strong call to action (CTA) that encourages visitors to take the desired action, such as signing up, making a purchase, or downloading a resource. Use white space effectively to guide the user's eye and to create a sense of balance. Ensure that the landing page is mobile-responsive, as many users will access it on their phones or tablets. Optimize loading times by compressing images and minimizing unnecessary scripts. Finally, consider A/B testing different elements of the landing page to determine what works best for your audience and to continuously improve conversion rates.
83c7e1d verified
Raw History Blame Contribute Delete
794 Bytes
// Smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
const target = document.querySelector(this.getAttribute('href'));
if (target) {
window.scrollTo({
top: target.offsetTop,
behavior: 'smooth'
});
}
});
});
// Form submission handling
document.addEventListener('DOMContentLoaded', function() {
const forms = document.querySelectorAll('form');
forms.forEach(form => {
form.addEventListener('submit', function(e) {
e.preventDefault();
const email = this.querySelector('input[type="email"]').value;
if (email && validateEmail