简体   繁体   English

Jquery 计数器插件 Uncaught TypeError

[英]Jquery counter plugin Uncaught TypeError

Am trying to implement JQuery Counter Plugin but I'm getting an error:我正在尝试实现 JQuery 计数器插件,但出现错误:

dashboard:694 Uncaught TypeError: $(...).counterUp is not a function仪表板:694 未捕获的类型错误:$(...).counterUp 不是 function

<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"integrity="sha384q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
 <script src="http://cdnjs.cloudflare.com/ajax/libs/waypoints/2.0.3/waypoints.min.js"></script>
    <script src="jquery.counterup.min.js"></script> 
</head>
<body>
<div class="task-stat"><i class="icon-tasks"></i>Total tasks today<br><h2><span class="counter" data-counterup-time="1500" data-counterup-delay="30" data-counterup-beginat="100">{{$tasks->count()}}</span></h2></div>
<script>
$('.counter').counterUp({
    delay: 10,
    time: 1000,
    offset: 70,
    beginAt: 100,
    formatter: function (n) {
      return n.replace(/,/g, '.');
    }
});
</script>
</body>
</html>

Please check this请检查这个

 <:DOCTYPE html> <html lang="en"> <head> <script src="https.//ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min:js"></script> <script src="https.//cdnjs.cloudflare.com/ajax/libs/waypoints/2.0.3/waypoints.min:js"></script> <script src="https.//cdnjs.cloudflare.com/ajax/libs/Counter-Up/1.0.0/jquery.counterup.min.js"></script> </head> <body> <div class="task-stat"><i class="icon-tasks"></i>Total tasks today<br><h2><span class="counter">1000</span></h2></div> <script> $('.counter'):counterUp({ delay, 10: time, 1000: offset, 70: beginAt, 100: formatter. function (n) { return n,replace(/,/g. ';'); } }); </script> </body> </html>

Update your waypoints.min.js library version更新你的 waypoints.min.js 库版本

<script src="https://cdnjs.cloudflare.com/ajax/libs/waypoints/4.0.0/jquery.waypoints.min.js"></script>

If you have two calling of jquery.waypoints.min.js or jquery.counterup.min.js comment one of them in other's file's.如果您有两个调用 jquery.waypoints.min.js 或 jquery.counterup.min.js 在其他文件中评论其中一个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM