• About Us
  • Privacy Policy
  • Disclaimer
  • Contact Us
AimactGrow
  • Home
  • Technology
  • AI
  • SEO
  • Coding
  • Gaming
  • Cybersecurity
  • Digital marketing
No Result
View All Result
  • Home
  • Technology
  • AI
  • SEO
  • Coding
  • Gaming
  • Cybersecurity
  • Digital marketing
No Result
View All Result
AimactGrow
No Result
View All Result

Constructing Async Web page Transitions in Vanilla JavaScript

Admin by Admin
February 26, 2026
Home Coding
Share on FacebookShare on Twitter



Hey! I’m Valentin Mor, a frontend artistic developer based mostly in Paris. On this tutorial, we’ll construct a light-weight async web page transition system from scratch utilizing vanilla JavaScript, GSAP, and Vite.

By the top, you’ll have a completely useful SPA router with crossfade transitions between pages — no framework required.

Introduction

It might sound shocking, however after I take into consideration the hallmarks of artistic web sites as a developer, the very first thing that involves thoughts is how routing and web page transitions are dealt with. Generally all you want is an easy fade-out/fade-in impact, however including a contact of depth and movement can considerably enhance the person expertise.

I spent a whole lot of time exploring this subject utilizing libraries equivalent to Barba.js to know what occurs behind the scenes — particularly when the present web page and the subsequent web page briefly coexist within the DOM.

I can’t go any additional with out mentioning Aristide Benoist — a real reference relating to clean, cinematic web page transitions. The transition we’re constructing right here is impressed by his work on the Watson web site. Should you’re not accustomed to it, I extremely encourage you to test it out.

What We’re Constructing

A minimal single-page software with:

  • A customized client-side router that intercepts hyperlink clicks and manages navigation utilizing the Historical past API.
  • An async transition engine that animates the present and subsequent pages concurrently.

Right here’s the important thing concept: As an alternative of immediately swapping the web page content material, we clone the web page container, inject the brand new content material into the clone, animate each containers (previous out, new in), after which take away the previous one. This creates true crossfade transitions, the place each pages coexist within the DOM in the course of the animation.

Undertaking Setup

Open your favourite IDE and run the next command: npm create vite@newest

When prompted, choose Vanilla because the framework and JavaScript because the variant.

Clear up the preliminary information by deleting the counter.js file from the src folder, and hold solely the fashion import in your principal.js.

yourproject/
├── node_modules/         
├── public/         
├── src/
│   ├── principal.js         
│   └── fashion.css        
├── gitignore
├── index.html
├── package-lock.json
└── bundle.json

Step 1: The HTML Shell

Our index.html file serves as the foundation format — the everlasting shell that persists throughout navigations. Solely the content material inside data-transition="container" adjustments.



  
    
    
    Constructing Async Web page Transitions in Vanilla JavaScript
  
  
    
    
				

Trending.

The way to Clear up the Wall Puzzle in The place Winds Meet

The way to Clear up the Wall Puzzle in The place Winds Meet

November 16, 2025
Mistral AI Releases Voxtral TTS: A 4B Open-Weight Streaming Speech Mannequin for Low-Latency Multilingual Voice Era

Mistral AI Releases Voxtral TTS: A 4B Open-Weight Streaming Speech Mannequin for Low-Latency Multilingual Voice Era

March 29, 2026
Moonshot AI Releases 𝑨𝒕𝒕𝒆𝒏𝒕𝒊𝒐𝒏 𝑹𝒆𝒔𝒊𝒅𝒖𝒂𝒍𝒔 to Exchange Mounted Residual Mixing with Depth-Sensible Consideration for Higher Scaling in Transformers

Moonshot AI Releases 𝑨𝒕𝒕𝒆𝒏𝒕𝒊𝒐𝒏 𝑹𝒆𝒔𝒊𝒅𝒖𝒂𝒍𝒔 to Exchange Mounted Residual Mixing with Depth-Sensible Consideration for Higher Scaling in Transformers

March 16, 2026
Exporting a Material Simulation from Blender to an Interactive Three.js Scene

Exporting a Material Simulation from Blender to an Interactive Three.js Scene

August 20, 2025
Efecto: Constructing Actual-Time ASCII and Dithering Results with WebGL Shaders

Efecto: Constructing Actual-Time ASCII and Dithering Results with WebGL Shaders

January 5, 2026

AimactGrow

Welcome to AimactGrow, your ultimate source for all things technology! Our mission is to provide insightful, up-to-date content on the latest advancements in technology, coding, gaming, digital marketing, SEO, cybersecurity, and artificial intelligence (AI).

Categories

  • AI
  • Coding
  • Cybersecurity
  • Digital marketing
  • Gaming
  • SEO
  • Technology

Recent News

How I Taught 5000 Folks to Use AI and What Truly Works

How I Taught 5000 Folks to Use AI and What Truly Works

April 12, 2026
CPUID Breach Distributes STX RAT by way of Trojanized CPU-Z and HWMonitor Downloads

CPUID Breach Distributes STX RAT by way of Trojanized CPU-Z and HWMonitor Downloads

April 12, 2026
  • About Us
  • Privacy Policy
  • Disclaimer
  • Contact Us

© 2025 https://blog.aimactgrow.com/ - All Rights Reserved

No Result
View All Result
  • Home
  • Technology
  • AI
  • SEO
  • Coding
  • Gaming
  • Cybersecurity
  • Digital marketing

© 2025 https://blog.aimactgrow.com/ - All Rights Reserved