我网站上的 JavaScript 似乎根本不起作用,因为我开始使用扩展功能,使用 base.html 文件来存储导航栏和页脚。我真的无法弄清楚为什么它不起作用。css 工作得很好,只是没有 javascript。有人对此有什么建议吗?
我已经包含了来自 1) base.html、2) extendedpage.html 和 3) 部分 js 函数的代码......我希望这是足够的信息。javascript 处理的元素位于其上方的块内容内。我只是无法弄清楚我做错了什么,我计划实际使用这个网站来做一些事情,所以我不想在每个 html 页面上重新打印页脚和导航栏。
TIA
{% block scripts %}
<!-- JS Global Compulsory (Do not remove)-->
<script type="text/javascript" src="{{ url_for('static', filename='/js/jquery-3.4.1.min.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='/js/popper/popper.min.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='/js/bootstrap/bootstrap.min.js') }}"></script>
{% endblock scripts %}
{% endblock body %}
</body>
{% endblock html %}
</html>
{% endblock doc %}
{% endblock content %}
{% block scripts %}
{{ super() }}
<!-- Page JS Implementing Plugins (Remove the plugin script here if site does not use that feature)-->
<script type="text/javascript" src="{{ url_for('static', filename='/js/jquery.appear.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='/js/counter/jquery.countTo.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='/js/range-slider/ion.rangeSlider.min.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='/js/owl-carousel/owl.carousel.min.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='/js/jarallax/jarallax.min.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='/js/jarallax/jarallax-video.min.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='/js/magnific-popup/jquery.magnific-popup.min.js') }}"></script>
<!-- Template Scripts (Do not remove)-->
<script type="text/javascript" src="{{ url_for('static', filename='/js/custom.js') }}"></script>
{% endblock scripts %}
POTENZA.rangesliders = function () {
if ($('.property-price-slider').exists()) {
var rangeslider = jQuery(".rangeslider-wrapper");
$("#property-price-slider").ionRangeSlider({
type: "double",
min: 0,
max: 10000,
from: 1000,
to: 8000,
prefix: "$",
hide_min_max: true,
hide_from_to: false
});
}
};