[英]Issue with javascript - stops working after 3 seconds
I'm having some issues with my javascript on a particular page.我在特定页面上的 javascript 遇到了一些问题。 This is very weird.
这很奇怪。
http://www.rayku.com/tutorshelp http://www.rayku.com/tutorshelp
How it is supposed to work is fetch from an external html file every time I flip through the tabs on the right.每次我翻阅右侧的选项卡时,它的工作原理是从外部 html 文件中获取。 However, after 3 seconds, it just stops working.
但是,3 秒后,它就停止工作了。 It doesn't matter how many times you flip before the 3 seconds (or any for that matter).
在 3 秒(或任何与此相关)之前翻转多少次都无关紧要。 After the 3 seconds, it just stops flipping.
3 秒后,它只是停止翻转。
Any ideas?有任何想法吗?
Dev tools are your friend...开发工具是你的朋友...
"Uncaught TypeError: Cannot call method 'load' of null" “未捕获的类型错误:无法调用 null 的方法 'load'”
on line 9 in:在第 9 行中:
http://www.rayku.com/js/tutorshelp-ajax.js http://www.rayku.com/js/tutorshelp-ajax.js
You are also including scripts twice.您还包括两次脚本。 I would look into that.
我会调查一下。
Yes, keep an eye on your web console, it will alert you of these types of issues.是的,请留意您的 Web 控制台,它会提醒您注意这些类型的问题。 When you click on a tab the console reads:
当您单击选项卡时,控制台会显示:
tutorshelp-ajax.js:9 Uncaught TypeError: Cannot call method 'load' of null
If you go to line 9 you'll see: $('#video-content').load('/help-external/video'+step+'.html');
如果您转到第 9 行,您将看到:
$('#video-content').load('/help-external/video'+step+'.html');
Since the message is cannot call method 'load' of 'null' it means that $('#video-content') is null.由于消息无法调用 'null' 的方法 'load',这意味着 $('#video-content') 为空。
This is happening because they are not wrapped in $(document).ready();发生这种情况是因为它们没有包含在$(document).ready(); 中。 and they are being set up before the
video-content
id even exists.并且它们是在
video-content
ID 甚至存在之前设置的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.