`Some Items Missing from Responsive Navigation Menu`

Hey there! I'm currently diving into the world of responsive design and I'm attempting to create a navigation bar that transforms into a menu when viewed on a mobile device or phone. Everything seems to be working fine, except that not all the navigation items are showing up on the mobile device and I'm scratching my head trying to figure out why! Here's the snippet of code:

<div class="container">
    <div class="navbar">
      <ul style="padding-left: 0px;">

        <li class="logo"> <a href="#">RONNIE<b>GURR</b></a></li>

                            <section class="div_navbar_items">
                              <li class="navbar_items"> <a href="#home">HOME</a> </li>
                              <li class="navbar_items"> <a href="#about_me">ABOUT US</a> </li>
                              <li class="navbar_items"> <a href="#skills">GALLERY</a> </li>
                              <li class="navbar_items"> <a href="#projects">SHOP</a> </li>
                              <li class="navbar_items"> <a href="#contact">CONTACT</a> </li>
                            </section>

                            <li class="icon">
                              <a href="#" onclick="navBarFunction()"> &#9776;</a>
                            </li>
                        </ul>
                    </div>
                </div>

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

Below is the snippet from the CSS file:

.container {
  margin: auto;
  width: 90%;
}
.navbar {
  position: fixed;
  z-index: 100;
  overflow: hidden;
  margin: auto;
  width: 100%;
  left:0;
  top:0;
}

... (CSS continues)

And here's the JS function for the responsiveness:</p>

<pre><code>function navBarFunction() {
    document.getElementsByClassName("navbar")[0].classList.toggle("responsive");
}

If you want to check out the code in action, head over to this CodePen link: https://codepen.io/anon/pen/JyEoWY

Answer №1

It seems like you're on the right track with setting your navbar height to 100% of the screen. However, be mindful of the padding and margin on your nav elements. Consider removing excess padding and margin from these styles and customize them further to suit your needs. If you prefer not to make these adjustments, you can follow the alternative method suggested in my response to enable scroll functionality for your navigation bar.

.navbar li a {
   margin-top: 0px;
}

@media screen and (max-width: 875px) {
.navbar.responsive li.navbar_items {
    display: block;
    padding: 0px;
    font-size: 25px;
}
}

Furthermore, review the overflow property set to hidden in your .navbar styling (line 8). To address this issue, consider updating the .navbar.responsive class by changing the overflow value to scroll for proper functionality.

@media screen and (max-width:875px) {
.navbar.responsive {
  position:fixed;
  width: 100%;
  height: 100vh;
  background-color: rgba(236,201,205, 1);
  transition: background-color .6s;
  overflow: scroll; // Adjust overflow to scroll
}
}

Answer №2

It seems like this issue occurred because of the code you added for the responsive navbar:

.navbar.responsive {
    position:fixed;
. This may have caused the block to not be scrollable, preventing you from viewing all the content. I was able to see all items in the menu when I changed the property to absolute.

Additionally, it looks like you mistakenly used pixels when setting the font-weight in CSS as font-weight: 700px, but it should actually be a relative value like font-weight: 700.

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 best way to incorporate server-side rendered content from a CMS to hydrate Vue.js?

Consider this scenario: content is managed through a traditional CMS such as Joomla or Drupal content is provided by the CMS as fully rendered HTML and CSS In the Frontend React.js should be utilized for all UI interactions. Despite going over most of R ...

I am looking for two divs or table cells to float alongside each other, with one set to display:inline and the other expanding to fill the remaining space of the row

What I desire: My current accomplishment: I successfully floated both DIV tags side by side and also experimented with tables. My goal is to have the HR line fill the remaining horizontal space that the title does not occupy. However, I prefer not to us ...

Is there a way for me to use an ajax xmlhttprequest to submit all the selected values from my radio buttons?

Here's the situation: I have four input forms [A-D] and I have selected options A and B. I want to transfer this information to another page, but I'm not sure how to do it. I've tried searching for tutorials on AJAX, but most of them focus ...

Creating a CSS animation to repeat at regular intervals of time

Currently, I am animating an SVG element like this: .r1 { transform-box: fill-box; transform-origin: 50% 50%; animation-name: simpleRotation,xRotation; animation-delay: 0s, 2s; animation-duration: 2s; animation-iterat ...

Maintaining photo proportions in HTML when using width and height as percentages

Is it possible to specify width and height as percentages in the <img> attributes? It seems that when I attempt to do so, the image resizes but the quality appears skewed. Here is an example of my markup with fixed attributes: <img src="#" widt ...

Transfer information using cURL without the need to refresh the webpage

I am trying to send data to an external API using cURL from a Facebook iframe page (not tab). However, I want to achieve this without reloading the form page. My idea is to use jQuery AJAX to display a "submitting data" message upon form submission and sh ...

Problem with custom anchor component in React that needs to perform an action before being clicked

React Component (Custom Anchor) import React from 'react'; class Anchor extends React.Component { onClick = (event) => { // ----------------------------- // send Google Analytics request ...

Ways to prevent a specific class from using CSS styling

My HTML <body> <div id="finalparent"> <!--many parent divs here--> <div id="1stparent"> <div id="txt_blog_editor" class="box" style="width: 1097px;"> <div class="abc anotherclass"> </div> & ...

Unexpected behavior observed when animating CSS transform in IE

I am currently facing an issue with a CSS animation on my website that animates an arrow back and forth. The animation is working perfectly on all browsers except for Internet Explorer, where there seems to be a glitch causing the Y position of the arrow t ...

Implementing a document update event using jQuery

On my WordPress site, I am using a responsive lightbox plugin. When an image is clicked, it opens a popup box with the ID fullResImage. Now, I would like to incorporate the Pinch Zoomer function to it. Do I need to bind a function for this, or is there a s ...

Navigate down the page until you reach the section that is set to display as a block

Is it possible to make the page automatically scroll to a specific element located in the middle of the page when changing its display property from none to block? ...

Multiplying array elements within the Vuex state with the assistance of Socket.io

I have developed an application using Vue and Vuex that connects to a Node/Express backend with Socket.IO to instantly push data from the server to the client when necessary. The data sent to the clients is in the form of objects, which are then stored in ...

Creating a customized list item design using Bootstrap 3 and incorporating div elements

I have designed a custom li element with Bootstrap 3, but I am looking to achieve something specific. . Here is my current setup- HTML- <ul class="list-group"> <li class="list-group-item" id="baal"> <div style="display: inlin ...

Having trouble accessing the input class with jQuery

When I click the "Reset To Default Settings" button in my form, I want to clear the default colors in my 4 color pickers. Each of them has an input type text field with the class anyicon-form-colorpicker. To achieve this, I locate the <a> tag and use ...

Grid Refresh Spinner Update

Our Vaadin Grid features a settings icon that when clicked, opens a window allowing users to select/deselect columns. Upon closing this window (triggering our custom window event), the main window's columns are updated accordingly. Now, my requirement ...

Enhancing Vue.js functionality with extra information stored in local storage

I've created a To Do List app where you can add tasks using a button. Each new task is added to the list with a checkbox and delete button in front of it. I'm trying to save all the values from the inputs and the checked checkboxes on the page on ...

When the webpage is launched, the font styles specified in the CSS do not take effect and

As a beginning coder, I have encountered a small issue. In my HTML document, I attempted to set the font types of my paragraphs and headings to Arial using CSS. The code snippet is as follows: h4{ font-family arial san-serif; } However, when I run the c ...

Generating an error during mongoose callback

Currently, I am in the process of developing a Node.js + Express application. The database I am working with is Mongo, and I have integrated Mongoose to establish a connection with this database. In my code, I am attempting to handle exceptions within a M ...

The transparent overlay div does not activate when clicking on a button in Internet Explorer 10

While tidying up my CSS and JavaScript, I may have gone a bit overboard. The code seems to work fine on Chrome, Safari, and Firefox, but it's causing chaos in IE10. Check out the code here <div id="bgmbutton1"> <img id="button1" src ...

Navigating intricate data structures within React

As a newcomer to React, I could use some assistance with a project I am working on. The application is similar to Slack, where users can create new teams and channels. However, I am encountering difficulties in managing the state of the data input throug ...