首页 > 解决方案 > jQuery - countTo 插件在本地工作,但不在服务器上

问题描述

我的以下代码在本地工作得很好,但是当上传到共享主机时,它会在一些随机数上停止。

单击“重新启动”按钮可以正常工作。但我希望在页面加载时第一次运行计数。

这是托管我的代码的链接: https ://spoose.com/others/test/

插件代码链接: https ://spoose.com/others/test/countto.js

$(function() {
  let the_timer = $('.timer').countTo();
  $('#restart').on('click', function() {
    the_timer.countTo('restart');
  });
});
<p class="timer" data-from="0" data-to="10000" data-speed="10000" data-refresh-interval="50"></p>
<button id="restart">restart</button>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="https://spoose.com/others/test/countto.js"></script>

标签: javascriptjqueryplugins

解决方案


推荐阅读