Tag: Organic Website Traffic

Grow your website traffic organically! Mafost Marketing’s blog explores proven strategies to attract visitors and boost your online presence. Find expert tips on SEO, content marketing, and more.

Join 900+ subscribers

Stay in the loop with everything you need to know.

Sign Up for Blog Notifications in Your Email

document.addEventListener("DOMContentLoaded", function() { // 1. Entrance & Parallax Logic (Keeping your existing work) var observer = new IntersectionObserver(function(entries) { entries.forEach(function(entry) { if (entry.isIntersecting) { entry.target.classList.add('is-visible'); } }); }, { threshold: 0.1 });var parallaxElements = document.querySelectorAll('[class*="mafost-parallax"]'); function handleParallax() { parallaxElements.forEach(function(el) { var rect = el.getBoundingClientRect(); var windowHeight = window.innerHeight; if (rect.top < windowHeight && rect.bottom > 0) { var percentage = (windowHeight - rect.top) / (windowHeight + rect.height); // NEW NOTICEABLE SETTINGS var travelDistance = 120; var move = (percentage * travelDistance) - (travelDistance / 2); var dir = el.classList.contains('mafost-parallaxup') ? -1 : 1; el.style.transform = 'translate3d(0, ' + (move * dir) + 'px, 0)'; } }); }document.querySelectorAll('[class*="mafost-"]').forEach(function(el) { observer.observe(el); });// 2. Optimized Silky Scroll var target = window.pageYOffset; var current = window.pageYOffset; var easing = 0.06; // Adjusted from 0.03 for better responsiveness var isRunning = false;window.addEventListener('wheel', function(e) { e.preventDefault(); target += e.deltaY; target = Math.max(0, Math.min(target, document.documentElement.scrollHeight - window.innerHeight)); if (!isRunning) { isRunning = true; render(); } }, { passive: false });function render() { var diff = target - current; // The "soft landing" happens here current += diff * easing; window.scrollTo(0, current);if (Math.abs(diff) > 0.1) { requestAnimationFrame(render); // Sync parallax during the glide if (typeof handleParallax === 'function') handleParallax(); } else { isRunning = false; } } });