Javascript 未加载django上的jquery
早上好,我有以下包含我的JS的模板。然而,我的浏览器上的模板正在显示,但没有给我想要的交互。当我检查控制台时,出现以下错误行:Javascript 未加载django上的jquery,javascript,jquery,django,Javascript,Jquery,Django,早上好,我有以下包含我的JS的模板。然而,我的浏览器上的模板正在显示,但没有给我想要的交互。当我检查控制台时,出现以下错误行: Error: Bootstrap's JavaScript requires jQuery bootstrap.min.js:6:37 ReferenceError: jQuery is not defined custom.js:4:1 ReferenceError: jQuery is not defined jquery.stellar.min.js:2:1 Re
Error: Bootstrap's JavaScript requires jQuery bootstrap.min.js:6:37
ReferenceError: jQuery is not defined custom.js:4:1
ReferenceError: jQuery is not defined jquery.stellar.min.js:2:1
ReferenceError: jQuery is not defined jquery.easing.1.3.js:39:1
Error: Bootstrap's JavaScript requires jQuery bootstrap.js:8:9
Using //@ to indicate sourceMappingURL pragmas is deprecated. Use //# instead jquery.js:1:0
ReferenceError: django is not defined
我真的不知道我在这方面做错了什么。
任何帮助都将不胜感激
这是我的代码:
{% load staticfiles %}
<!DOCTYPE html>
<html lang="en">
<head>
{% include 'website/loaders_scripts/headers.html' %}
<title>{% block title %}Default title{% endblock %}</title>
</head>
<body>
{% include 'website/components/nav_bar.html' %}
{% block body_content %}
{% endblock %}
{% include 'website/components/footer.html' %}
<!--LOAD SCRIPTS-->
<script type="text/javascript" src="{% static 'js/bootstrap.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/custom.js' %}"></script>
<script type="text/javascript" src="{% static 'js/jquery.stellar.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/jquery.easing.1.3.js' %}"></script>
<script type="text/javascript" src="{% static 'js/bootstrap.js' %}"></script>
<script type="text/javascript" src="{% static 'js/jquery.js' %}"></script>
<script type="text/javascript"src="{% static 'js/plugins.js' %}"></script>
<script type="text/javascript"src="{% static 'js/video.js' %}"></script>
<script type="text/javascript" src="{% static 'js/waypoint.js' %}"></script>
<script>
$(function() {
$(window).alert("Hello")
var BV = new $.BigVideo({useFlashForFirefox:false});
BV.init();
if ((/iPhone|iPod|iPad|Android|BlackBerry/).test(navigator.userAgent)) {
BV.show('img/cover.png');
} else {
BV.show('http://video-js.zencoder.com/oceans-clip.mp4',{
altSource:'http://video-js.zencoder.com/oceans-clip.ogv'
});
}
BV.getPlayer().volume(0);
$('body').on('click', '.mute.muted', function(){
BV.getPlayer().volume(0.8);
$(this).removeClass('muted').addClass('unmuted');
return false;
});
$('body').on('click', '.mute.unmuted', function(){
BV.getPlayer().volume(0);
$(this).removeClass('unmuted').addClass('muted');
return false;
});
});
</script>
</body>
</html>
{%load staticfiles%}
{%include'website/loaders\u scripts/headers.html%}
{%block title%}默认标题{%endblock%}
{%include'website/components/nav_bar.html%}
{%block body_content%}
{%endblock%}
{%include'网站/components/footer.html%}
$(函数(){
$(窗口)。警报(“你好”)
var BV=new$.BigVideo({useFlashForFirefox:false});
BV.init();
if(/iPhone | iPod | iPad | Android | BlackBerry/).test(navigator.userAgent)){
BV.show('img/cover.png');
}否则{
BV.show('http://video-js.zencoder.com/oceans-clip.mp4',{
altSource:'http://video-js.zencoder.com/oceans-clip.ogv'
});
}
BV.getPlayer().volume(0);
$('body')。在('click','.mute.mute',function()上{
BV.getPlayer().volume(0.8);
$(this.removeClass('muted').addClass('unmuted');
返回false;
});
$('body')。在('click','.mute.unmute',函数()上{
BV.getPlayer().volume(0);
$(this.removeClass('unmuted').addClass('muted');
返回false;
});
});
您需要在bootstrap.js之前加载jquery.js
<!-- First load jquery.js -->
<script type="text/javascript" src="{% static 'js/jquery.js' %}"></script>
<!-- Now load bootstrap.js-->
<script type="text/javascript" src="{% static 'js/bootstrap.js' %}"></script>
它工作正常,但我看到了这个警告,我不知道它的作用是什么:使用/@表示sourceMappingURL pragmas已被弃用。使用//#而不是jquery.js:1:0改变对象的[[Prototype]]会导致代码运行非常缓慢;而是使用object.create bootstrap.js:34:415使用getPreventDefault()创建具有正确初始[[Prototype]]值的对象。不推荐使用getPreventDefault()。改用defaultPrevented。@SlangI'mmatalk显示该消息是因为您没有jquery源映射文件。有关完整的解释和解决方案,请参见此问题: