Last active
July 30, 2024 12:44
-
-
Save diegoliv/e1daf4d101ba53025419f34d77cbc6fe to your computer and use it in GitHub Desktop.
Webflow page transition - delay page load to allow interaction to play after clicking on a link
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
(function($) { | |
$(function(){ | |
$('a').on('click', function(e) { | |
const href = this.href; | |
const url = new URL(href); | |
if (window.location.origin === url.origin) { | |
e.preventDefault(); | |
setTimeout(function() { | |
window.location.href = href; | |
}, 2100); | |
} | |
}); | |
}); | |
})(jQuery); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment