• 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.

AI-Assisted Menace Actor Compromises 600+ FortiGate Gadgets in 55 Nations

AI-Assisted Menace Actor Compromises 600+ FortiGate Gadgets in 55 Nations

February 23, 2026
Introducing Sophos Endpoint for Legacy Platforms – Sophos Information

Introducing Sophos Endpoint for Legacy Platforms – Sophos Information

August 28, 2025
How Voice-Enabled NSFW AI Video Turbines Are Altering Roleplay Endlessly

How Voice-Enabled NSFW AI Video Turbines Are Altering Roleplay Endlessly

June 10, 2025
10 tricks to begin getting ready! • Yoast

10 tricks to begin getting ready! • Yoast

July 21, 2025
Rogue Planet’ in Growth for Launch on iOS, Android, Change, and Steam in 2025 – TouchArcade

Rogue Planet’ in Growth for Launch on iOS, Android, Change, and Steam in 2025 – TouchArcade

June 19, 2025

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

Pokémon’s thirtieth anniversary merch has followers in multi-hour queues

Pokémon’s thirtieth anniversary merch has followers in multi-hour queues

February 26, 2026
Marquis Sues SonicWall Over 2025 Firewall Information Breach

Marquis Sues SonicWall Over 2025 Firewall Information Breach

February 26, 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