Hamburger must be used in order for the menu to be displayed

Whenever I visit the site, the menu remains hidden.
However, when I resize the page and use the hamburger icon, the menu appears as expected.
Even after resizing the page back to its original size, the menu continues to be visible.
Refreshing the site causes the same problem to occur again.

You can see the issue on my demo page:

I would greatly appreciate your assistance with this matter.

Thank you.


Code:

body {
  min-height: 100%;
}


/* HEADER */

#header {
  position: absolute;
  top: 0px;
  left: 0px;
  height: 1000px;
  right: 0px;
  overflow: hidden;
}

.backgroundheader {
  top: 0 !important;
  position: relative !important;
  height: 350px;
  background-color: #333;
  box-shadow: 0px 0px 50px 0px rgba(0, 0, 0, 1);
  background-image: url("images/bamboo.png"), url("images/bamboo2.png");
  background-repeat: no-repeat;
  background-size: 560px, 195px;
  width: 100%;
  min-width: 100%;
  background-position: top right, top left
}

.logo {
  left: 0 !important;
  position: absolute;
  height: 200px;
  width: 600px;
  margin-top: 70px;
  box-shadow: 0px 0px 50px 0px rgba(0, 0, 0, 0.8);
  background-color: #AB2732;
  float: left !important
}


/* HEADER */


/* MENU */

ul {
  list-style-type: none;
  position: absolute;
  top: 50%;
  left: 50%;
  margin-right: -50%;
  transform: translate(-50%, -50%);
  padding: 0;
  overflow: hidden;
  font-size: 220%;
  font-family: menu
}

li {
  float: left;
}

li a {
  display: block;
  color: white;
  text-align: center;
  padding: 23px;
  text-decoration: none;
}

li a:hover {
  background-color: #111111;
}

.vyber {
  position: absolute;
  background-color: #AB2732;
  background-size: 100%;
  width: 100%;
  height: 100px;
  margin-top: 410px;
  -webkit-animation-name: example;
  /* Safari 4.0 - 8.0 */
  -webkit-animation-duration: 4s;
  /* Safari 4.0 - 8.0 */
  animation-name: vysunuti;
  animation-duration: 0.8s;
  box-shadow: inset -0px 0 40px rgba(0, 0, 0, 0.7);
  margin-bottom: 200px;
}

.hamburger {
  visibility: hidden;
}

.hamburger-box {
  margin-top: 80px;
}

@media screen and (max-width: 1246px) {
  ul {
    top: 345px;
    z-index: 99
  }
  ul li {
    ;
    background-color: #333;
    display: block;
    text-align: center;
    width: 100%
  }
  .hamburger {
    visibility: visible
  }
  .hamburger-box {
    -webkit-animation: hamburger 0.5s ease-in-out;
    animation: hamburger 0.5s ease-in-out;
  }
}

@-webkit-keyframes hamburger {
  from {
    opacity: 0
  }
  to {
    opacity: 1
  }
}

@font-face {
  font-family: menu;
  src: url("fonty/menu.otf");
}


/* MENU */


/* MENU */
<div class="nav" id="header">
  <div class="backgroundheader">
    <div class="logo"></div>
    <div class="simple-ss"></div>

    <div id="container">
      <div class="navbar-header">
        <button style="right: 0 !important; position: absolute;margin-right: 30px;margin-top: 350px;z-index: 10" class="hamburger hamburger--spring navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" type="button">
                            <span class="hamburger-box">
                                <span class="hamburger-inner"></span>
                            </span>
                        </button>

        <div class="vyber">
          <div class=" collapse " id="bs-example-navbar-collapse-1">
            <div class="navbar-header">
              <ul>
                <li>
                  <a href="#">About Us</a>
                </li>
                <li>
                  <a href="#">Restaurant</a>
                </li>
                <li>
                  <a href="#">Running Sushi</a>
                </li>
                <li>
                  <a href="#">Contact</a>
                </li>
                <li>
                  <a href="#">Photo Gallery</a>
                </li>
              </ul>
              <div>

              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

Answer №1

Don't stress about the hamburger.

Check out this pseudo code explaining how your website currently functions:

YOUR PSEUDO CODE

var showMenu = false;
var showButton = false;

if 1246px > windowWidth 
    showButton = true;

if buttonIsClicked == true
    showMenu = !showMenu;
        (it toggles between true and false)

ISSUE

Your goal is to display the menu when a user visits the website.
When windowWidth is less than 1246px, hide the menu and show the button. If the user manually hides the menu and increases windowWidth above 1246px, you should re-enable the menu. Here's the revised pseudo code for that scenario:

BETTER PSEUDO CODE

var showMenu = true;
var showButton = false;

if 1246px > windowWidth 
    showButton = true;
    showMenu = false;

if 1246px < windowWidth
    showMenu = true;

if buttonIsClicked == true
    showMenu = !showMenu;

Now armed with this information, tackling your CSS issue should be a breeze.

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

What is the process for building a grid system similar to Bootstrap's 12-column grid using the new CSS Grid Layout?

Is there a way to implement a 12-column grid system similar to Bootstrap using CSS Grid? I am struggling to understand this new technology and would greatly appreciate it if someone could provide a demo. My goal is to create a simple grid structure resem ...

What is the best way to split a jQuery tab into four equally sized divs?

I am currently working with jquery tabs and within one of the tabs, I have 4 google charts each enclosed in a separate div. My goal is to position each div in a different quadrant of the tab area (north, south, east, and west of the screen). Currently, my ...

Retrieving HTML table data using PHP

In the scenario where I have an HTML form with a table like the one below: <form method="POST" action="a.php"> <table name="dataTable"> <tr> <td>row one col one</td> <td>row one col two</td> <td>row o ...

Three-color linear gradient SVG with a middle color expanding in width

I'm working with a linear gradient and here is the code: <svg width="120" height="240" > <linearGradient id="dsp" x1="0" x2="0" y1="0" y2="1"> <stop class="stop1" offset="0%"/> <stop class="stop2" offset="50%"/> ...

Please assist in changing the text color of the right side of my navigation bar to white with the help of Bootstrap

Is there a way to change the text color of my nav-bar to white, while keeping the background as 'primary-subtle' with Bootstrap? How can I override Bootstrap's default functions using CSS when combining these two styles? Here is the code sn ...

Utilizing multiple address parameters within a single-page application

Apologies for the lengthy post. I have encountered an issue with my code after running it through a bot that I can't seem to resolve. In my code, I aim to create functionality where you can visit the address #two, followed by two separate parameters ...

What is the best technique for creating a preloader that can seamlessly fill the background of a vector image?

I am looking for guidance on creating a CSS3 preloader using a vector image. My goal is to have the logo start off transparent with only the border visible, and as the loading occurs, fill in from bottom to top with the background color. Thank you to ever ...

Styles in CSS for the first column of a table, with the exception of the first cell in

Here is the HTML code for a table: <table class='census'> <tr> <th colspan="2">My Title</th> </tr> <tr> <td colspan="2" class='chart'><SOME PIE CHART, GENERATED W ...

Trigger the scrolling of one div when another div is scrolled

Link to Jsfiddle I'm attempting to activate my current scroll while I am outside that scroll, specifically in #DivDet Here is the code snippet of what I have tried so far: $("div#DivDet").scroll(function () { // Still trying to figure out what ...

When I apply properties in JavaScript, I find that I am unable to utilize the CSS "hover" feature

For a personal project I am currently working on, I decided to experiment with setting background colors using Javascript. However, I have encountered an issue where my CSS code that changes the hover property does not seem to work after implementing the J ...

`place the table inside a hidden div`

I am trying to create a non-editable table that can be overlayed with a div under specific conditions. However, it seems like my current implementation is not working as expected. What could be causing this issue? CSS <style type="text/css"> # ...

retrieve the image name of the background using jQuery

How can I use jQuery to extract only the background image name from a div with a background image? I currently get 'http://localhost/xampp/uconnect/images/tour-networks-ss.png' but I only want 'tour-networks-ss.png' Any assistance wi ...

A guide on resolving the 'Unexpected identifier array in JSON Parse Error' encountered during an AJAX Request

I'm currently working on setting up a Contact Form Validation and I require the variable $msg from a php script called 'sendEmail.php'. The actual mailing system is functional, as the script successfully receives form inputs from index.php a ...

Ways to achieve a darker background with rgba(0,0,0,0.5)

Hey there, if this isn't the right place to post my query, could someone guide me on where to do so? TL;DR = I need to darken the background of my showcase image! I'm working on a website as part of an online course project to practice new skil ...

Arranging nested Divs for horizontal scrolling purposes

I'm struggling to achieve horizontal scrolling only in my provided example link HERE. It seems like a simple fix should be adding {overflow-x:auto; and overflow-y:hidden;} in the CSS, but I've tried that and it's not giving me the desired re ...

Is it possible to align a row so that it is centered based on one of the columns in the row?

Calling all experts in CSS and HTML: Let's say I have 3 columns in a row, each with a different size (refer to the image). Now, picture this - I want to center the 2nd column right in the middle of my page. If I simply use justify-content: center to ...

Make the div stretch to the bottom of the webpage

This question may be a common one, but despite my efforts, I have not been able to find a solution to what seems like a simple issue. Here is the code snippet in question: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> ...

Copying to the clipboard now includes the parent of the targeted element

Edit - More Information: Here is a simplified version of the sandbox: https://codesandbox.io/s/stupefied-leftpad-k6eek Check out the demo here: https://i.sstatic.net/2XHu1.jpg The issue does not seem to occur in Firefox, but it does in Chrome and other ...

Display the scrollbar within a flexitem by utilizing flexbox styling

I am currently setting up my HTML website with Bootstrap flex and I have a specific layout in mind. I want the inner div to have scrollbars while the outer div fills up the rest of the page. Take a look at this example: <div class="d-flex align-items- ...

Adding JQuery to a running webpage using the DOM and Opera browser add-ons

I'm currently working on an Opera Extension and I have a question. Is there a way to use the includes folder in order to directly inject jQuery into the live HTML of a webpage? For example, can I change the background color of the DOM to black? If ...