以下是我正在使用的模板代码。我使用基础作为框架,现在我只是尝试拉出范围滑块。使用相同的静态类型链接,CSS工作正常,它只是似乎不适合我的JavaScript。当我在视图源中跟踪文件并单击文件的链接时,它会转到文件的代码。那个,为什么js代码不起作用?
<!DOCTYPE html>
{% load staticfiles %}
<link href="{% static "styling/css/normalize.css" %}" rel="stylesheet">
<link href="{% static "styling/css/foundation.min.css" %}" rel="stylesheet">
<link href="{% static "styling/css/custom.css" %}" rel="stylesheet">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<div class="row">
<div class="small-10 medium-11 columns">
<div class="range-slider" data-slider data-options="display_selector: #sliderOutput3;">
<span class="range-slider-handle"></span>
<span class="range-slider-active-segment"></span>
</div>
</div>
<div class="small-2 medium-1 columns">
<span id="sliderOutput3"></span>
</div>
</div>
<script src="{% static "styling/js/jquery.js" %}"></script>
<script src="{% static "styling/js/foundation.min.js" %}"></script>
<script>
$(document).foundation();
</script>
</body>
答案 0 :(得分:2)
好像你错过了基础脚本标签末尾的&gt; 标志:
<script src="{% static "styling/js/foundation.min.js" %}"></script
应该是:
<script src="{% static "styling/js/foundation.min.js" %}"></script>
你应该通过W3C Validator(或其他一些验证器)检查生成的html,这通常有帮助。