最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

javascript - Delay a href link for some seconds - Stack Overflow

matteradmin5PV0评论

I have a little animation which i want to show thats why i want to delay a link. Help would be nice.

echo '<td><a href="Detail.php?id='.$row["id"].'" onclick="Splash()"></a></td>';

js:

<script>
function Splash()
{
  setTimeout( function()
  {

  }, 2000);
}
</script>

I have a little animation which i want to show thats why i want to delay a link. Help would be nice.

echo '<td><a href="Detail.php?id='.$row["id"].'" onclick="Splash()"></a></td>';

js:

<script>
function Splash()
{
  setTimeout( function()
  {

  }, 2000);
}
</script>
Share Improve this question asked Mar 14, 2014 at 15:36 user3400389user3400389 3671 gold badge6 silver badges21 bronze badges 1
  • could you please include your plete code? You might want to look in to promise(). api.jquery./promise – timo Commented Mar 14, 2014 at 15:37
Add a ment  | 

1 Answer 1

Reset to default 6

Change it to

echo '<td><a href="Detail.php?id='.$row["id"].'" id="spashlink"></a></td>';

and add a script

 $(function() {
      $('#spashlink').on('click', function(e) {
          e.preventDefault();
          var self = this;
          setTimeout(function() {
              window.location.href = self.href;
          }, 2000);
      });
 });
Post a comment

comment list (0)

  1. No comments so far