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

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

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745626456a4636836.html

相关推荐

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

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

    7小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信