flipclock.js shooting error Uncaught TypeError: Cannot call method 'FlipClock' of null

左心房为你撑大大i 提交于 2019-12-11 19:19:34

问题


I'm trying to set-up flipclock.js on my site however it doesn't seem to be loading no matter what I do, chrome gives me the following error:

Uncaught TypeError: Cannot call method 'FlipClock' of null

My code is laid out as follows:

<head>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script>

<script src="/flipclock/src/flipclock/js/libs/base.js"></script>

<script src="/flipclock/compiled/flipclock.min.js"></script>

</head>



<body>

<div class="clock" style="margin:2em;"></div>

<script type="text/javascript">
jQuery(document).ready(function() { 
    var clock = $('.clock').FlipClock(new Date(2014,8,30).getTime()/1000 - new           Date().getTime()/1000, {
    clockFace: 'DailyCounter',
    countdown: true
   });
   });
  </script>

  </body>

All of the jquery files are loading just fine. I only receive that one error mentioned above. I've also tried moving the flipclock files below my body so they load after but with no luck and same error. Would appreciate some ideas on fixing this. Thanks.


回答1:


Try to use:

jQuery('.clock')

instead of:

$('.clock')


来源:https://stackoverflow.com/questions/22400090/flipclock-js-shooting-error-uncaught-typeerror-cannot-call-method-flipclock-o

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!