Dynamic menu causing interference with other elements of the code

When the width reaches a maximum of 37.em, the navigation styled under a hamburger menu automatically opens. I would prefer it to remain closed rather than open when scaled to that size. It also allows the underlying menu underneath it (div.gallery with clickable radio buttons/labels) to show, and I'd like the navigation to push everything below it down once opened.

Below is the HTML code:

<!DOCTYPE html>
<html lang="en">
<head>
    <link rel="icon" 
    type="image/png" 
    href="mpicon.png">
    <title>The Marshall Project | About Us</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
  <link href="about.css" rel='stylesheet' type='text/css' />
    <!-- javascript -->
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></s...   

Here is the CSS:

/* split sides (for content) and navigation */
*, *:after, *:before { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; }

/* configuring support of HTML5 */
header, main, nav, footer, figure, figcaption, aside, section, article {
    display: block;
}

/* general body styles */
body {
    font-family: Franklin Gothic, Arial, sans-serif;
    margin: 0px;
    padding: 0px;
    overflow-x: hidden;
}
#intro {
...

and here is the external JavaScript:

$(document).ready(function() {

    $(".burger-nav").on("click", function() {

        $("header nav ul").toggleClass("open");

    })

})

Answer №1

First off, there seems to be redundancy in including jquery multiple times within your html code. Consider removing all duplicates except for the one located at the bottom of your html document. It’s generally recommended to load script tags towards the end of your markup.

Additionally, it is advisable to utilize css classes to style and target your markup elements instead of directly applying styles using inline style tags.

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

When it comes to AFrame+Three.js, which is more efficient: having numerous meshes with minimal triangles per mesh or having a few meshes with a high number of

Currently working with Aframe 1.0.4 and Three.js 111, I am exploring the performance differences between: Whether it is better to have a few entities with a high number of triangles or many entities with fewer triangles each. Specifically, I am debating ...

Display webpage content in an Iframe using Javascript after PHP code has been executed

Despite researching keywords like PHP // Javascript // Load // URL online, I'm still struggling to fully grasp the concepts. Real-life case studies have been helpful, but I must admit that I'm feeling a bit overwhelmed at the moment. I created a ...

Tips for dynamically updating the id value while iterating through a class

Here's the HTML snippet I am working with: <div class="info"> <div class="form-group"> <label class="control-label col-sm-2">Title</label> <div class="col-xs-10 col-sm-8"> <inpu ...

Using IMG HTML tags in PHP embedded within JavaScript code

Is there a way to successfully add an IMG src tag in JavaScript to pass the image source to a JavaScript variable 'content' and then have it passed to a PHP variable '$html'? I've attempted this but keep encountering an 'unide ...

Enable automatic profile login for the Firebase application

Imagine a web application created using Vue and Firebase. The main query revolves around automatically logging into the app after page reload, particularly accessing the database post authorization. Following user authentication, crucial data such as email ...

javascript When the page is equal to X, logical operators do not perform their function

When navigating to pageAge or pageMore, I want the if statement not to execute. It functions properly on pageAge by not running the script, but on pageMore it does. I am unsure which operator to use in this scenario. Placing pageMore before the || works ...

Looking for ways to locate encoded HTML values in chrome?

Referenced from Microsoft Docs In MVC, the Razor engine automatically encodes all output coming from variables. For example, consider the following razor view: @{ var untrustedInput = "<"123">"; } @untrustedInput In this scenario, ...

JavaScript code for sorting a list of objects alphabetically according to a different list

I am looking to alphabetically sort a list of objects based on another list of characters and the 'name' property. Below is the sorting order I would like to use: const SortingArray = [['a','á','à','â', ...

Can someone explain the meaning and syntax of this code in a clear way

I recently encountered this syntax in a tutorial and I'm unsure if it's ES6. It was part of a reduce function. Can someone provide a clear explanation of what is happening inside these parentheses? {...curr, ...acc} Here is the full code snippe ...

Angular 4 - The Promising Outcome: How to Retrieve the Value upon Completion

Is there a way to retrieve a value from a promise and store it in a global variable? I've been attempting to accomplish this, but the global variable remains undefined. import { Injectable } from '@angular/core'; import {ActivatedRouteSnap ...

To access the link, simply click once if there is no child menu. However, if there is a child menu attached, be sure to click

I am working on a mobile menu that is designed to slide out when clicked. Currently, the parent pages are displayed by default. I want to implement functionality where if a parent page has child pages, clicking on it will slide down the sub menu. If click ...

What is the best way to declare a global variable while making an asynchronous call using AngularJS?

Is there a way to utilize the single_video variable outside of the controller function? The issue arises when attempting to access it in the second console.log, as it returns an 'undefined' error due to asynchronousity despite successfully printi ...

Looking to determine if a specific element is assigned multiple class names

Help needed! Can you tell me how to check if an element contains more than one classname using pure javascript, without using jQuery? For example: If #test has both the classnames "classA and classB", then { alert(true) } else { alert(false) } Here is ...

Ionic 4: Facing issues with setting complete background image on ion-card

https://i.stack.imgur.com/3lH6h.png I'm currently attempting to set a background image for an Ion-card in order to completely cover the card's area. However, I'm facing an issue where the background image does not cover the entire area and ...

Event not tracking properly due to missing label in GA event firing

Seeking assistance with a project I'm currently engaged in. I have created an HTML5 video containing a playlist and encountering difficulties setting up multiple labels in GA to track each individual video play. While I found code online, adapting it ...

Images stored in a WAR file

While this question may seem familiar, it's actually a unique situation. In Eclipse, within the WebContent folder, I have various directories such as images, jsp, WEB-INF, and META-INF. Testing the page using the Tomcat instance within Eclipse shows t ...

PHP Pagination Made Easy

Currently, I am developing a website focused on HIV prevention information warehousing. Numerous collaborators will be contributing articles using a tinyMCE GUI. The design team is keen on having control over page lengths. They are interested in implement ...

Sending HTML output to a PHP script

After setting up my HTML form with an action attribute pointing to "filename.php" and a method of post, I managed to generate JSON output by clicking the Submit button using the following code: $('#result').text(JSON.stringify($('form' ...

Using a conditional statement in conjunction with the jQuery .animate function

As a complete novice with Javascript and jQuery, I am attempting to animate a div only if a specific variable is true, but unfortunately, it's not functioning as expected. Can someone offer guidance on how to resolve this issue? Below is the code I h ...

Verify if the user has logged in through an HTML interface

Can users confirm their ASP.NET account status from an HTML file without resorting to AJAX calls to the server? ...