为href添加延迟(Laravel)

时间:2017-11-06 12:14:18

标签: javascript jquery laravel

我想为href添加延迟时间

 href = {{ page( ) }}

我想在重定向到下一页之前添加延迟时间。

1 个答案:

答案 0 :(得分:3)

Laravel没有选择。 你可以用JS做到这一点:

<a id="theLink" href = {{ page( ) }}>LINK</a>


<script>
  $('#theLink').on('click', function(e) {
      e.preventDefault();
      var self = this;
      setTimeout(function() {
          window.location.href = self.href;
      }, 2000);
  });