Implemented sub navigation within off canvas navigation, allowing sub menu headers and menus to remain visible even when the main menu is closed

I've been working on customizing an existing off-canvas design and I've run into a roadblock. I added submenus, but they're displaying even when the menu is closed. I suspect it's a positioning problem, but despite spending several days trying to figure it out, I'm stuck. The issue only arises when the viewport is small enough for the media queries to kick in. Here is the code:

You can see the problem in action on the live site here. I attempted to create a JSFiddle, but encountered functionality issues. Make sure to view it in Chrome, resize the browser to observe the off-canvas menu problem.

HTML:

<!DOCTYPE html>

<html class="no-js">
...

CSS:

body {
  color: #333;
  position: relative;
  width: 100%;
  min-width: 20em;
  background: #7C9769;
}

.block {
  position: relative;
  margin: 0 auto;
  padding: 1.5em 1.25em;
  max-width: 60em;

}
...

@media screen and (min-width: 45.0625em) {
...

Here's a screenshot demonstrating the issue in Google Chrome:

Answer №1

Consider incorporating the following attributes into

.csstransforms3d.csstransitions.js-ready #main-nav .block
this specific class within a media query.

CSS

@media screen and (max-width: 45em) {
.csstransforms3d.csstransitions.js-ready #main-nav .block {
-webkit-transform: translate3d(-100%, 0, 0);
-moz-transform: translate3d(-100%, 0, 0);
-ms-transform: translate3d(-100%, 0, 0);
-o-transform: translate3d(-100%, 0, 0);
/*Additional styles can be included here*/
}
}

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

Incorporate an XML buffer into the form data

Currently, I am facing an issue while attempting to upload an XML file using superagent (Protractor Testresults) within a NodeJS context. My approach involves using 'fs' to read the XML file using readFileSync, which results in a Buffer Object fo ...

The never-ending loop of a jQuery function continues indefinitely

Having some trouble with this code. It's supposed to take the first line, check it, remove it, and then move on to the next line. However, if all lines are empty, the code just keeps running endlessly without stopping. function getSocksListInput() { ...

How can you retrieve the value of a CSS file in Javascript and CSS?

Imagine there is an element with the class .selector. This class defines its style. Once the page has finished loading, some JavaScript code is executed - the specifics are not important. What matters is that the CSS properties have set the object's ...

Can you tell me if the "dom model" concept belongs to the realm of HTML or JavaScript?

Is the ability to use "document.X" in JavaScript to visit an HTML page and all its tags defined by the HTML protocol or the ECMAScript protocol? Or is it simply a choice made in the implementation of JavaScript, resulting in slight differences in every bro ...

Outputting PHP code as plain text with jQuery

My aim is to set up a preview HTML section where I am encountering a difficulty. I am struggling to display PHP code when retrieving and printing it from a textarea in the HTML. Here are my current codes, This is the HTML area where the textarea code will ...

Is it possible to establish globally applicable values using CSS?

Is it possible to set global attributes within a wordpress site to override all instances of specific CSS styles across multiple locations for themes, 3rd party plugins and more? For instance, if I want to apply 'border-radius: 0px;' to all butt ...

What is the rationale behind placing the CSS outside of the React function components, near the imports?

Recently, I encountered an issue with loading CSS inside a React function component using Material UI. Even though I managed to resolve it, I am still intrigued by the underlying reason. Initially, I had something like this setup where I placed both makeSt ...

Real-time update of quiz results based on varying factors

In my quiz, I have set up variables that start at 0 and increase based on certain conditions. One variable should increase when a question is answered correctly, while the other should increase when a question is answered incorrectly. If you answer a quest ...

Utilizing graphics within the Atom text editor

Hey, I have a bit of a silly question. I can't seem to figure out why these images aren't showing up on my Atom editor. Can anyone help me with this? <body> <div class="top-container"> <img src="images/clou ...

Showing videos on Django Template: Link to Media

Struggling to retrieve a video from a model as the correct URL is not being found even after adding the media directory in front of it. Is the method I am using to pull the URL from the model accurate? Check out the Code, Generated HTML, and Console log ...

Modifying the attributes/properties within a class of a bootstrap button

Here is the code that I have: <b-button id="search-button" size="md" class="mt-1 w-100" type="submit" @click="someEvent()" >Example </b-button If we imagine calling someEvent() and wanting to modi ...

Tips for changing the value of a scope variable without the need for a function

I was attempting to implement pagination on a webpage and it seems to be functioning correctly. However, I have encountered an issue in the code that I require assistance with. Within my controller, I have a scope variable that I utilized for querying dat ...

The process involves transferring information from a specific div element to a database. This particular div element obtains its data after receiving an appended ID

It's a bit complicated, but I'm working on creating a tag system. I'm fetching data from a database with an AJAX call using the "@" symbol. Everything is working fine - the tags are being generated, but I'm having trouble retrieving and ...

How exactly did Google Fiber design their onboarding guide?

Are you using HTML5 canvas animation or Flash for this website? It's a bit difficult for me to discern. Thank you! ...

When I retrieve a URL from PHP, I receive XY data in JSON format. The output appears as [{"status":"ok","data":{"latitude":0.625,"longitude":0.855}}], but the final outcome is reported as "undefined"

When I try to retrieve XY coordinates from a URL in JSON using PHP, the returned result looks like [{"status":"ok","data":{"latitude":0.625,"longitude":0.855}}]. However, the end result shows as "undefine ...

What is the best way to choose all cells that begin, include, or finish with a specific term using JQuery/CSS?

I have a table with some cells and I am looking to utilize JQuery to select specific cells. For example: <td>John Doe</td> <td>John Doe1</td> <td>1John Doe</td> I want to select cells that start with 1, include Doe, a ...

Checkbox paired with a read-only text column

I have a simple HTML input field with JavaScript functionality, which includes a checkbox. I am trying to write text in the input field when the checkbox is checked, and make the input field read-only when it is not checked. Can anyone provide an example ...

Is there a way to customize the hover color of the Bootstrap 4 navbar toggler?

I'm working with Bootstrap 4 and I would like the color of my navbar toggle icon (commonly referred to as the burger menu) to change when it is hovered over. I have attempted the following code but it is not producing the desired result: .navbar-light ...

What is the best way to display a menu at the location of a mouse click?

Trying to display a custom menu at the location of a mouse click within a div, but it doesn't seem to be working as expected. The visibility logic works fine, but when clicking on the div, the menu only opens under the Typography element. Should the M ...

What is preventing the fontawesome icon from appearing in Chrome and Safari browsers?

Why isn't my fontawesome icon displaying in Chrome and Safari? I'm using Bootstrap and Fontawesome, but for some reason the icons are not showing up in Chrome and Safari. Here is my code. I can't believe I'm struggling with such a simp ...