Delayed page load JQuery not working

Could anybody take a look and tell me what’s going wrong with my page load delay? I followed this pixel geek tutorial to the letter (as far as I’m aware), and can’t figure out why the page transition isn’t working.

This is the code I added:

** ---------- Here is my site Read-Only: https://preview.webflow.com/preview/mikes-spectacular-project-e759bf?utm_medium=preview_link&utm_source=designer&utm_content=mikes-spectacular-project-e759bf&preview=20fbfa1c0c14ff3d9940982a91f24734&mode=preview

Hi @RachaelVizioli,

Could you provide the code you pasted on the settings? I doesn’t shows.

Thanks!

1 Like
<script>

$(‘a.delayedLink’).click (function (e) {
e.preventDefault();
var goTo = this.getAttribute(“href”);

setTimeout(function(){
  window.location = goTo;
},1000);  

});

There’s a close script at the bottom too but it’s not showing for some reason! ( </script> )

@RachaelVizioli - Class on your button is delayedlink vs delayedLink in your script - may be causing the issue.

@sam-g They’re definitely the same now but still not working… :thinking:

Any more ideas??

https://preview.webflow.com/preview/mikes-spectacular-project-e759bf?utm_medium=preview_link&utm_source=designer&utm_content=mikes-spectacular-project-e759bf&preview=20fbfa1c0c14ff3d9940982a91f24734&mode=preview

@RachaelVizioli - I’m still seeing the mismatch on your webflow.io address. I just tested and believe that to be the cause.

hey @RachaelVizioli I also test it and I believe is the code, I will create a clone project so you can see it working.

I’ll let you know!

Thanks!! :relaxed:

I never got that code to work, but I did some digging and added this other suggestion to the custom code footer and it worked perfectly!

<script>
    $(function(){
        $("a").click(function(evt){
            evt.preventDefault();
            var link = $(this).attr("href");
            setTimeout(function() {
                window.location.href = link;
            }, 1000);
        });
    });
</script>

I have no idea why the other didn’t though!

1 Like