The hamburger menu is not functioning properly online, but it works perfectly in xampp/localhost

I'm currently facing a challenge with my responsive menu. It works perfectly on my offline server in mobile format, but as soon as I upload it to the real server, it stops working. I've been grappling with this problem for hours. Here's the snippet of code causing the issue:

HTML

   <div class="menu">      
        
        <div class="menu_bar">
            <img id="logo-mobile" src="design/logo-titol-prova-1.PNG">
            <a href="#" class="bt-menu"><span class="icon-menu"></span></a>
        </div>
 
        <nav>
        <img id="logo" src="design/logo-titol-prova-1.PNG">
            <ul>
                <li class="first"><a href="about">About</a></li>
                <li><a href="surf-salina-cruz">Surf/Kitesurf</a></li>
                <li><a href="mexico-surf-tour">The Tour</a></li>
                <li><a href="surf-camp-lodging">Lodging</a></li>
                <li><a href="testimonials">Testimonials</a></li>
                <li><a href="book-now">Reserve Now</a></li>             
            </ul>
        </nav>
    </div>

CSS

... (CSS code remains unchanged) ...

menu.js

$(document).ready(main);
 
var contador = 1;
 
function main(){
    $('.bt-menu').click(function(){
        // $('nav').toggle(); 
 
        if(contador == 1){
            $('nav').animate({
                right: '0'
            });
            contador = 0;
        } else {
            contador = 1;
            $('nav').animate({
                right: '-100%'
            });
        }
 
    });
 
}

script-menu.js

... (JavaScript code remains unchanged) ...

This is the website: . I have exhausted all my options and spent countless hours troubleshooting. If you have any insights on how to resolve this issue, your help would be greatly appreciated. Thank you!

Answer №1

It appears that you may have overlooked including the js/ directory before referencing menu.js. To rectify this, please update your code as follows:

<script src="menu.js"></script>

Please modify it to:

<script src="js/menu.js"></script>

Answer №2

When attempting to connect a file stored in the system, make sure to provide a valid URL link.

For example: www.example.com/file.js

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Differentiating Routes in React JS to the Same Path

My website currently has a navigation bar with the following options: Home|Shop|About. However, I am looking to add a link on my Home page that will open the same shop page as the one in the navbar. Is it possible to implement two different routes that le ...

Exploring the mechanics of JavaScript and jQuery Ajax: What's the secret to its function

It's common knowledge that browsers are single-threaded, meaning they can only either render the UI or execute Javascript snippets. While web workers offer a way to achieve multi-threading, let's focus on the default behavior. I'm curious a ...

Want to learn how to create an image magnifier using just one image?

At first, I created an image magnifier that would zoom in when the user hovered over the image. However, now I am looking to switch to a lens zooming method that uses only one image. ...

Challenges with ReactToPrint Library and Optimizing Layout for Thermal Printer

Working on a React.js project, I have been using the ReactToPrint library to print a specific section of my page. However, I am facing an issue where the page size remains too large and important content is being left out in the printed receipt. It seems ...

Ways to automatically update ng-class based on changes in ng-model value

I am working on a code where I need to add classes to the 'label' based on whether the input box is empty or not. To achieve this, I am checking if the input box is null and adding classes accordingly. <div class="col-md-12"> <input ...

Styling in media queries can override the styles of its parent element without

Here's the fiddle I've been working on: http://jsfiddle.net/9vu64/ Everything was functioning smoothly with my dummy site queries, until I added the following code snippet below. In the fiddle, it seems that #header is adjusting its width based ...

Identifying added elements that respond to link hover effects

I've been working on a project where I'm trying to replace the default browser cursor with an SVG one using jQuery. Everything seems to be working smoothly, except for changing the cursor when it hovers over links - nothing I've tried so far ...

Firebase onCall function is executing properly, however, it is only delivering {data: null} as the

I am facing an issue with my cloud function where everything runs smoothly until I attempt to return a response back to the front-end. Despite successfully modifying databases, the final log points D and G still show {data:null} as the output. I have a fe ...

Ways to identify when a specific react component has been clicked

Currently working on developing a klondike game with 4 empty stacks at the start of the game. The initial page layout resembles the first image provided in the link. I am facing an issue where I cannot determine which component was clicked when clicking on ...

Iframe Interactivity

My goal is to create an interactive iframe that will match the current parent URL (). For example, if I have an iframe pointing to http://www.google.com and click a link within the iframe, it should update the parent URL to , and then load the clicked con ...

Having issues with jQuery AJAX not functioning correctly in PHP environment?

Can someone explain how Ajax and jQuery work together? I'm new to both technologies and I want to use Ajax to delete a row in my index.php file. <head><link rel="stylesheet" type="text/css" href="css/style.css"></head> <h1&g ...

Achieving a consistent border-radius effect during hover transitions

I designed a div that initially displays an image, but upon hovering over it, a second div with text and a solid colored background appears to mask the original content. To see what I'm talking about, check out my jsfiddle: 'Mask on Hover' ...

Looking for assistance with parsing football league standings from a website using PHP

Is there a way to use PHP to extract an HTML table from a website? References: The table I want to parse can be found here: This is the code I attempted to use: <div class="row"> <div class="col-md-8"> <h1>Standings</h1 ...

Tips for testing nested HTTP calls in unit tests

I am currently in the process of unit testing a function that looks like this: async fetchGreatHouseByName(name: string) { const [house] = await this.httpGetHouseByName(name); const currentLord = house.currentLord ? house.currentLord : '957'; ...

Utilizing PUG for Iterating Through Multiple Items in Express Framework using JSON Data

I'm currently working on a small application using Express and PUG, aiming to achieve the following: https://i.stack.imgur.com/ZDyTK.png index.pug ul#restaurants-list li img.restaurant-img(alt='Mission Chinese Food', sr ...

How can one efficiently prevent an O(n) callback in Node.js from congesting the event loop?

Currently, I am in the process of developing a node server for a basic social media platform. This server facilitates fundamental CRUD operations for posts, comments, and likes. My upcoming task involves implementing a notification service to disseminate n ...

Is there a surefire way to ensure a table border functions properly across all web browsers?

I am facing an issue with the border of a table. Currently, the border appears correctly on Brave browser but extends too far on Chrome and Safari. If I try to make it smaller, the border does not reach all the way to the <td>. Is there a solution to ...

Transmit a JSON object to the server using a JavaScript function

I am attempting to transmit a JSON object to a remote server but I am not receiving a success message. Can someone please help me identify what is incorrect in this code: function sendSMS(){ var input = '{"header":"****","****":*****,"****":"**** ...

The URL may change, but Angular remains on the same page without navigating

I am encountering an issue with 2 links in my application. The first time I click on any one of them, it navigates to the corresponding page without any problem. However, when I click on the second link after that, the URL changes but the navigation does n ...

Prevent clicking on a div using Jquery

Imagine I have a simple click event set up for an HTML div element. When the div is clicked, it should trigger a fadeToggle effect. Inside that div, there is another nested div with its own click event. Upon clicking this inner div, it is supposed to do s ...