0

The JavaScript on my website doesn't seem to be working at all, since I started using the extend feature, using a base.html file to store the nav bar and footer. I really really can't work out why it isn't working. The css is working absolutely fine, just no javascript. Does anyone have any advice on this??

I have included the code from 1) base.html, 2) the extendedpage.html, and 3) part of the js function.... I hope this is enough info. The element that the javascript works on is inside a block content above this. I just cant work out what I am doing wrong, and I plan on actually using this website for stuff so I dont want to have to reprint the footer and navbar on every single html page.

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
      });
    }
  };
Liam Webb
  • 1
  • 3
  • `exists()` is not a standard jQuery method. Where are you getting that method from? – Taplar Apr 20 '20 at 21:16
  • If I am honest, I got this function from a template. I am new to jQuery. I will try to find it. Where will it be defined?? @Taplar – Liam Webb Apr 20 '20 at 21:24
  • //Check if function exists $.fn.exists = function () { return this.length > 0; }; @Taplar – Liam Webb Apr 20 '20 at 21:25
  • Ok, so the first thing I would do would be to verify that that method is working in your logic. – Taplar Apr 20 '20 at 21:28
  • @Taplar It worked normally. But as soon as i moved to flasks 'extend from' method. It stopped working – Liam Webb Apr 20 '20 at 21:33

0 Answers0