django上的jquery没有被加载

时间:2015-12-05 06:08:29

标签: 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
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>

1 个答案:

答案 0 :(得分:1)

您需要在 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>