Streaming live at 10am (PST)

Delay link click - not working


#1

Need to delay a link click so there is time to animate an out interaction.

tried this

  $('#aboutLink').click(function(e) {
     e.preventDefault();
       var linkUrl = $(this).attr('href'):
       setTimeout(function(url) { window.location = url; }, 5000, linkUrl);
  });

& this

$(function(){
$("#aboutLink").click(function(evt){
    var link = $(this).attr("href");
    setTimeout(function() {
        window.location.href = link;
    }, 2000);
  });
});

Neither seem to be working! What am I doing wrong?

Live Link - http://emma-dodi-final.webflow.io/

Preview Link - https://preview.webflow.com/preview/emma-dodi-final?preview=3b2674bca8d4db06d4969a2d511f9a44

Thanks,
Will


Time delay on current page before load next page
#2

@samliew Do you know why nether of these work in webflow? I’ve used them outside in sublime text before. Would be great to figure this one out as I know there are a lot of other people on the forum trying to achieve this.


#3

It’s working, but only on the first element on the page with the ID aboutLink. This is because IDs have to be unique. If you want to affect multiple elements you should be looking at using class selectors.


#4

Oh wow it’s magically started working. Thank you @samliew I’ve learned so much from your replies, you’re the man. :slight_smile:


#5

Sorry, but may I ask which code worked for you? I’m trying to use it with a class, but none of them seem to be working.

Thanks a lot!


#6

Would like to know what @gabermesz asked, too. It’s not working. I tried to put it in the footer of the whole project and a single page (not at the same time).

I animated a button click but the page loads too fast.