Skip to content

Instantly share code, notes, and snippets.

@diegoliv
Last active January 11, 2024 20:32
Show Gist options
  • Save diegoliv/e1daf4d101ba53025419f34d77cbc6fe to your computer and use it in GitHub Desktop.
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
<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