The issue of overflowing content and scrolling causing sections of the webpage to be hidden

I've been diving into HTML, CSS, and jQuery to enhance my personal website.

However, I've encountered an issue when trying to implement larger menus - they don't display properly when scrolling, and I can't seem to pinpoint the reason.

The easiest way to showcase the problem, especially since I lack technical jargon knowledge, is by providing a visual:http://jsfiddle.net/jcml/kmxdo4ha/

   Deciding which part of the code to share without overwhelming anyone is an obstacle.   

After some investigation, I have identified two main issues:

1 - While scrolling up or down, the entire menu isn't visible (and must stay vertically centered as the menu changes in height dynamically).

2 - The menu.ico icon also scrolls and could become hidden once the menu is closed.

Edit: I managed to solve problem #1, but now the vertical centering of the menu is disrupted after removing this snippet from the code:

.links ul{
    top: 50%;
    -webkit-transform: translateY(-50%);
    -moz-transform: translateY(-50%);
    -ms-transform: translateY(-50%);
    -o-transform: translateY(-50%);
    transform: translateY(-50%);
}

Edit2: You might notice the menu.ico issue if you open the menu, scroll all the way down, then close it. To fix it, you'll need to hover over the button and scroll back up for it to display properly.

Edit3: Problem #2 seems to have a solution, albeit requiring significant changes to the website structure. Nevertheless, it's good practice to make such improvements!

Answer №1

To address the initial issue, consider implementing flexbox to provide a solution. Modify the problematic style with something similar to the following code snippet:

.links ul{
    display:flex;
    flex-direction:column;
    justify-content:center;
    height:100%;
}

For a working example, refer to this fiddle.

Answer №2

I am a bit confused about the .ico you mentioned.

However, I believe that adding some padding-top: 20px; to the menu wrapper and perhaps some padding-bottom: 20px; should prevent your menu from getting cut off.

If you do not have a menu wrapper, you can simply enclose the text menu items in question within a nested div.

.menunavwrapper { 
  width: 100%;
  height: 300px; // for example
  padding-top: 20px;
  padding-bottom: 20px;
}

This is how you would structure it in HTML.

<section class="menunavwrapper">
<!-- List of menu items goes here -->

<ul>
<li>Example</li>
</ul>

</section>

Answer №3

I successfully resolved issue number 2.

The key was to restructure the div layout so that scrolling in one did not affect the other. Initially, I had a different navigation setup in mind which worked with the previous div structure.

Although I managed to fix problem number 1 with the first edit in the original post, it introduced another issue. It's challenging to explain without completing the navigation, but I will attempt to address it later. If I can't solve it, I'll update this post with more details.

Here is the updated version that resolves problem #2: http://jsfiddle.net/jcml/bby7522h/

I'm unsure which portion of the code to include without pasting everything.

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

Prevent css from reverting to its original rotation position

I attempted to style the navigation list with the following CSS: #navlist:hover #left-arrow { border-top: 10px solid white; position: relative; transform: translateX(120.2px) rotate(180deg); } Would it be better to use jQuery for the rotation ...

The browser is disregarding the CSS rule set for the checkboxes

I am experiencing an issue with a div called "popup" that is supposed to display a popup menu with a checkbox labeled "more" for getting additional items. However, changing the properties of "#popup" or "overflow-y: scroll;" does not have any effect as the ...

What is the best way to structure an XML document?

After successfully cURLing the JSS Casper API in PHP and receiving a response in XML, I noticed that in the browser, the XML is displayed without any whitespace, all on one line. Here's an example of the XML data: <accounts> <users> ...

Troubleshooting: Issue with Jquery functionality when selecting an item from dropdown menu

I've been trying to dynamically select an item from a dropdown menu, but for some reason it's not working even though I've followed the suggestions on this forum. Here is my HTML: <div> <div class="form-group"> <la ...

Bootstrap: Problem arises when columns do not total up to 12 and are pushed onto separate rows

So, I've been working with Bootstrap to structure columns and rows. It seems like I have the container, rows, and columns set up correctly for each post. However, I am puzzled as to why a new row is created for every post I make, causing them to stack ...

Troubleshooting a Dynamic Navigation Bar Problem with jQuery Integration

Having developed a responsive navbar, an issue arises during iPad breakpoints where attempting to close the active navbar by clicking the hamburger icon triggers the jQuery script to also perform .removeClass(".active").slideToggle() on two buttons, causin ...

Unable to stream Icecast link on Chrome browser

Recently, I encountered an issue with my custom-made player where no sound would come out when opened in Chrome. This has never happened before and I am puzzled as to why. Regardless of how the player is accessed - whether through a pop-up or by pasting th ...

"Enhance readability by adjusting the font size on mobile devices and iPhones for an

I'm currently working on a website that needs to maintain a consistent look across all types of devices, including laptops, PCs, iPads, iPhones, and other smartphones. To achieve this, I've implemented fittext.js, a pure JavaScript solution that ...

DIV will not show the Real Ajax Uploader interface

I've hit a roadblock. I recently purchased the Real Ajax Uploader Source codes and it functions perfectly on its own. However, when I attempt to display it in a DIV, things go haywire - only showing one DIV with non-functional JS code inside. There ar ...

An error notification is indicating the presence of an unforeseen angle bracket, even though it should not be there

I recently wrote some code for my node server using node.js. While the HTML part is working fine, I encountered strange errors in the developer console when adding scripts to the index.html file: Uncaught SyntaxError: Unexpected token < jquery-1.12.4.m ...

Prevent users from entering past dates in the date input field

In my project, I have decided to use input type date instead of datepicker. Is there a way to prevent users from selecting back dates in input type date without using datepicker? If you have any suggestions, please let me know. Thank you! ...

"Enhance Your Video Experience with a Personalized Play Button

Is it possible to customize the play icon for an embedded YouTube video? I came across a post discussing this topic: Can I change the play icon of embedded youtube videos? However, when trying to use something transparent as the new play button, the origin ...

Surprising Outcomes of Negative Margin in jQuery Animation

Unique Project Summary I am currently working on a website that incorporates a sliding menu feature. I have successfully implemented this functionality, and the display remains consistent during the animation transitions for sliding the menu in and out. T ...

The program is unable to identify the function .modal("show") upon adding HTML to the page

I'm currently developing a program that utilizes a click event handler to trigger an ajax request to my node server. The server then generates information within a handlebars partial and sends it back to the client using res.render("partials/scraped-a ...

Tips for adjusting the range slider's increment by selecting a radio button

There are two radio buttons and multiple range sliders available. Each radio button has a distinct value assigned to it. The desired functionality is that when one of the radio buttons is clicked, the maximum value should change (from 12 to 24 or from 24 ...

Tips on how to customize an HTML form submission appearance

Take a look at my file upload form below: <form action="upload.php" method="post" enctype="multipart/form-data"> <input type="file" name="filetoupload" id="filetoupload" onchange="this.form.submit();"> </form> I am trying to figure out ...

Is it possible to incorporate a php file within .htaccess?

Can anyone provide guidance on how to include a PHP file using .htaccess? I've searched online but haven't been able to find a helpful tutorial or code. Below is the PHP include code that I have tried: <?php require('footer.php'); ...

running a WordPress website on a local server

I'm currently facing an issue with exporting my WordPress website locally. When I try to export it, I get an XML file, but with the All in One WP Migration plugin, it gives me a "WPRESS" file instead. I don't have the budget to pay for a business ...

Arabic Presentation of Sweetalert Error Confirmation Icon

When using sweetalert in right-to-left (RTL) direction, the checked icon on sweetalert displays a problem, as shown below: Large image view the image here Is there any solution to this issue? Note: This problem is only visible in RTL (Arabic) direction. ...

What is the best way to include additional text in a dropdown menu?

I'm trying to add the text "Choose Country" in a drop-down list before the user selects their country. example1 Here is the line of code I used: <option data-hidden="true"> Choose Country </option> However, the phrase does ...