This script adds smooth page transitions to your Webflow site with just a few clicks. Simply copy the component below, paste it into your project, and customize the animation directly in Webflow's interactions panel — no coding required.
Click the button below to copy the transition component to your clipboard. Then paste it anywhere in your Webflow project using Cmd+V (Mac) or Ctrl+V (PC).
Add these two code snippets to your project settings.
Go to Project Settings → Custom Code and paste the Head Code in the "Head Code" section and the Footer Code in the "Before </body> tag" section.
<style>
body .pm-transition {display: block}
.w-editor .pm-transition {display: none;}
.no-scroll-transition {overflow: hidden; position: relative;}
</style><script>
let transitionTrigger = $(".pm-transition-trigger");
let introDurationMS = 600;
let exitDurationMS = 1000;
let excludedClass = "no-transition";
// On Page Load
window.addEventListener("DOMContentLoaded", (event) => {
if (transitionTrigger.length > 0) {
Webflow.push(function () {
transitionTrigger.click();
});
$("body").addClass("no-scroll-transition");
setTimeout(() => {$("body").removeClass("no-scroll-transition");}, introDurationMS);
}
});
// On Link Click
$("a").on("click", function (e) {
if ($(this).prop("hostname") == window.location.host && $(this).attr("href").indexOf("#") === -1 &&
!$(this).hasClass(excludedClass) && $(this).attr("target") !== "_blank" && transitionTrigger.length > 0) {
e.preventDefault();
$("body").addClass("no-scroll-transition");
let transitionURL = $(this).attr("href");
transitionTrigger.click();
setTimeout(function () {window.location = transitionURL;}, exitDurationMS);
}
});
// On Back Button Tap
window.onpageshow = function(event) {if (event.persisted) {window.location.reload()}};
// Hide Transition on Window Width Resize
setTimeout(() => {$(window).on("resize", function () {
setTimeout(() => {$(".pm-transition").css("display", "none");}, 50);});
}, introDurationMS);
</script>After pasting the transition element, convert it to a Symbol/Component and add it to all pages where you want transitions to work. This ensures the animation triggers consistently across your entire site.
The script includes several customizable options at the top of the code:
introDurationMS: 600 — Duration of the page entrance animation (in milliseconds)exitDurationMS: 1000 — Duration of the page exit animation (in milliseconds)excludedClass: "no-transition" — Add this class to any link you want to exclude from transitionsOnce installed, you can fully customize the transition animation directly in Webflow:
Simply edit these interactions to create your own unique transitions. Add blur effects, sliding panels, scaling animations, or anything else you can imagine — it's all customizable through Webflow's native interaction panel. No code needed.
The default setup includes a subtle blur effect, but you can replace it with any animation you want: sliding doors, fade effects, morphing shapes, or even complex multi-step animations. The component gives you complete creative control while handling all the technical complexity behind the scenes.