admin管理员组

文章数量:1434978

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);
      });
 });

本文标签: javascriptDelay a href link for some secondsStack Overflow