Jquery/site help

Hi everyone,

I’ve been using the site below to learn the basics which has been great, but I’m stuck. I just want the hamburger menu icon to spin and the mobile menu to appear on click, and have loaded in the function but looks like the jquery has not been called properly possibly? Any help appreciated, ive tried multiple different ways of getting this going so forgive the mess if you’re diving in. Inspecting the site there is no ‘event’ showing around the hamburger so the active class is not being added. thank you!

https://onerahifootball.club/

Hi @RiseElectric

Looking in Developer Tools I see a 404 Not Found is returned on with all scripts (with the exception of main.45473.js. Because of this $ which is the jQuery shorthand is not defined. Therefore the hamburger (and anything else that requires jQuery) will not work.

The first thing to check is the path of the missing JS files. You can download the deployed files to check they were deployed, and if so, where they are.

Thank you, I must be missing something. I can see that they did deploy, but they must not be in the right place to be called through properly. Is there a general rule on where to to call the files from? For example I have in the head.html file as that’s where everything else seemed to be, but maybe the directory I’m pointing it through is wrong? Hope that makes sense

You can place your files in any folder, all you have to do is make sure the paths point to where they are.

In your case, the relevant script tags you have are:

<script src="/jquery-3.1.1.min.js"></script>
<script src="/swiper.min.js"></script>
<script src="/app.js"></script>

These are all saying the files should be in the ‘root’ folder.

So check to make sure those files are in the root, and if they’re not you can either move them there, or adjust the paths to where the files actually are.

Where are you putting these files?

If the js directory is in the same location as the img directory (which does work on the live site) the original path (e.g. /js/app.js) should work.

I’ve put them in the js folder but yeah, still getting the same errors when i call that path

Currently the path is incorrect as they are referencing the src directory which likely is not a published directory

<script src="./src/js/jquery-3.1.1.min.js"></script>

If you can share your repository, this may help provided more targeted assistance.

yeah youre right, i’ve tried a few different ones, that was the latest trying to point it in the right direction. I’ll put it back to the proper /js/ and go from there