`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

Is there a way to set up a global web socket in NextJs?

I recently completed a tutorial on setting up a socket chat app, which I found at the following link: tutorial link. While I have successfully managed to get the system up and running, I'm facing an issue with exporting the front-end socket from the i ...

To obtain the desired response, I must make an additional GET request

Upon sending the first GET request to this endpoint, I receive a response of allEvents = []. However, if I wait a few seconds and hit the endpoint again, I get the desired results with a populated allEvents array. It seems that the function is not executin ...

The convergence of lighttpd with AngularJS's html5 mode offers a powerful

My angularJS website is hosted on a lighttpd server, but the html5 mode encounters a 404 error when I refresh or use a direct link. On my local Apache server, everything works fine and there are no issues with the rewrite expression in the .htaccess file. ...

Verify whether an email is already registered in firestore authentication during the signup process using Angular

When a user signs up for our app, I want them to receive immediate feedback on whether the email they are attempting to sign up with already exists. Currently, the user has to submit the form before being notified if the email is taken or not. This desire ...

The react-select onChange event fails to render when passed with certain props

I recently started using the select-react library, which can be found at So far, I have successfully mapped options to individual items from my itemList. The dropdown registers the selected option, but my ultimate goal is for the bar chart to render the c ...

Troubleshooting problem with CSS overflow and absolute positioning on Android Browser

Our mobile web app was created using a combination of JQuery Mobile, PhoneGap, and ASP.net MVC. It is designed to function smoothly on both iOS and Android devices regardless of the browser being used. We have conducted tests on various devices and everyth ...

Error: react-testing-library throwing validateDOMNesting warning

Warning: validateDOMNesting(...): <tbody> cannot appear as a child of <div>. in tbody (created by TableBody) in TableBody (created by TableBody) in TableBody Inquiry: Is there a way to render the TableBody component within a table ...

Switching between pages and updating the URL without needing to refresh the page, while still maintaining the content even after a refresh

After experimenting with jQuery's load() method to dynamically change content without refreshing the page, I encountered a recurring issue: the URL remains unchanged. Even when attempting to use history.pushState() to modify the URL, the problem pers ...

Upon concatenation, the screen automatically returns to the beginning of the page

I've set up a page with a list of items, and at the bottom there's a handy "Load more" button that fetches new items to add on top of the existing list: handleLoadProducts = (append = false) => { this.setState({ isLoading: true, ...

Adjusting the Transparency of the Background in a Pop-Up

I am experiencing an issue with my popup where I want the background to be transparent. However, when I set the opacity in CSS to 0.5 or less, the text also becomes transparent and very dark. How can I achieve a background with 50% opacity while keeping th ...

Steps for removing an item from an array using lodash

I have an array containing objects and I am looking to remove specific items based on certain conditions. Can someone guide me on how to achieve this using the lodash map function? Example: [{a: 1}, {a: 0}, {a: 9}, {a: -1}, {a: 'string'}, {a: 5 ...

Looping through multiple AJAX calls

I have come across numerous questions on this topic, but I am still struggling to find a solution that will make my code function correctly. There is a specific function for calling AJAX that I am unable to modify due to security restrictions. Here is how ...

Issue with CSS: Hover effect causing unexpected additional white space

My main goal is to implement a hover effect that covers an entire section, but I'm facing some challenges. When I hover over my products, it doesn't behave as expected and adds extra white space below while not covering the section properly. Thi ...

a script in JavaScript that retrieves the selected value from a radio button box

I have an AJAX table where I need to highlight one of the rows with a radio box on the left side. However, I lack proficiency in JavaScript and would like assistance in retrieving the value of the radio box by its ID from this table once it has been select ...

Can we be confident in the security and effectiveness of utilizing ajax for login implementation?

Hello, I've written the code below to verify if a user is eligible to log in to a database. I've utilized SSL to secure the connection, but I'm unsure if this is still an effective method. Could anyone provide some advice? Thank you for your ...

Having trouble parsing the JSON object values within the Error section of the Ajax call

When making an Ajax call to a rest web API, I encountered an error that I need help resolving. Here is the code snippet: $.ajax({ url: "/********/getbytitle('****')/items", type: "POST", contentType: "applicat ...

Insert HTML code at the top of a WordPress page

Currently, I am in search of a solution for the following issue: I want to include a black bar at the top of every page using a plugin (similar to the WordPress admin bar that appears when you are logged in at wp-admin). Initially, I considered adding th ...

Utilizing a Node.js web server in conjunction with an Apache Cordova Application

I have created an innovative Apache Cordova Application that leverages a Node.js web server to retrieve data from a web API, enabling the JavaScript-based project to utilize the information obtained from the API. Is there a method to integrate this Node w ...

Incorporate a glyphicon into a webpage design that wasn't originally built with bootstrap while maintaining the original layout

Looking to jazz up my vintage website with some cool glyphicons on a specific page. Don't want to mess up the entire look of my site by installing bootstrap. Is there a way to add just the "glyphicons functionality" without changing everything else? ...

"Utilizing Javascript in an ERB view file within the Rails framework

In my .js.erb file, I need to execute a conditional statement when an ajax call is triggered. Below is the code snippet: function updateContent() { $('.organiser__holder').html('<%= escape_javascript render("filter_links") %>' ...