The menu appears with a gentle fade and smoothly descends into place

I am embarking on my first venture into creating an animated menu.

Take a look at this image to see what I have in mind:

The arrows serve as a visual representation of my desire for the names to drop down and fade in when the menu button is clicked. Additionally, I aim for the menu to expand evenly across the page.

I have made an attempt to create a fiddle, but progress has been slow:

Check it out here: http://jsfiddle.net/dz0cee5L/21/

Below is the CSS code:

.button-container {
    width:100%;
}
.button {
    padding: 7px 30px;
    cursor: pointer;
    vertical-align: middle; 
    border: 2px solid;
    display: inline-block;
}
#navcontainer ul {
    margin: 0;
    padding: 0;
    list-style-type: none;
    text-align: center;
    width:100%;
}
#navcontainer ul li { 
    display: inline; 
}

#navcontainer ul li a {
    text-decoration: none;
    padding: .2em 1em;
    color: #dbd5d1;
}

#navcontainer ul li a:hover {
    color: #fff;
    background-color: #b93037;
}

Answer №1

To incorporate a smooth transition in your design, consider utilizing a CSS approach involving the properties opacity and top.

Ensure that the menu is styled with position: absolute to prevent any interference with the layout. You can then conceal it using top: 100% and opacity: 0, complemented by transition: opacity 1s, top 1s for an animated effect. Implement jQuery to handle toggling the display class.

CSS:

#navigation {
    opacity: 0;
    position: absolute;
    top: -100%;
    transition: opacity 1s, top 1s;
}
#navigation.displaying {
    opacity: 1;
    top: 100%;
}

JS:

$(".trigger").click(function() {
    $("#navigation").toggleClass("displaying");
});

SEE DEMO

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

Modifying the color of a div based on a specified value using JavaScript

<div id="navigation"> Add your text here </div> <input type="text" id="newColor"><button onclick="modifyColor()">Update</button> <script> function modifyColor(){ var chosenColor = document.getElementB ...

Ways to stop Bootstrap 4 dropdown from appearing when clicking on an input field?

Here is a straightforward bootstrap dropdown menu example, but with a twist - the toggle element is a text input. Instead of showing the dropdown on click event, I want it to appear when the user inputs something so I can dynamically populate the menu base ...

Issue with border radius in MUI 5 affecting table body and footer elements

Currently, I am diving into a new project utilizing React version 18.2 and MUI 5.10.3 library. My main task involves designing a table with specific styles within one of the components. The table header should not display any border lines. The table body ...

The NgFor is unable to iterate over an array because it is being treated as an

When attempting to call a new endpoint for displaying data, I noticed that the previous set of data is wrapped with an extra pair of brackets '[]', which seems to be causing a problem. The new endpoint does not format the data in this way when I ...

Visual Studio 2017 experiencing compatibility issues with Bootstrap

I've been working on creating a carousel using bootstrap within Visual Studio 2017. I utilized the NuGet package manager to install jQuery and Bootstrap, and to test its functionality, I generated a bootstrap snippet for the carousel. Take a look at ...

When using html-pdf-chrome to print to an A4 PDF, there appears to be a significant space below the A

In my Laravel project, I am currently utilizing the westy92 / html-pdf-chrome library to convert HTML to PDF. The front-end of my project is based on React. I have defined a series of divs to act as A4 pages: <div id="pdf" className="pri ...

Why is my column height being adjusted?

I may not be a professional web developer, but I am taking on the task of designing a website for a non-profit organization. After spending several days searching through resources and tutorials on CSS, float, position, and more, I finally managed to cre ...

Swapped out image hyperlink for a clickable button

As someone new to javascript, I'm encountering an issue with this code. I want to update my image links when a button is clicked in my code. However, the problem is that my image links are already being updated before I even click the button. Below ar ...

What is the best way to deactivate all submit buttons and then activate certain ones?

I currently have this script implemented in my asp.net mvc 3 web application to disable all submit buttons when clicked by the user, in order to prevent multiple submissions of the same data: $(document).ready(function () { $("input[type='submit ...

Formatting Dates

If I have the following: var date = new Date(parseInt(jsonDate.substr(6))); This returns: Mon Feb 22 1993 00:00:00 GMT+0000 (GMT Standard Time) Is there a way to change this to display as 22-02-1993 instead? ...

Exploring Multidimensional Arrays in JSON with jQuery for Parsing

While I have browsed through numerous questions on this platform, I haven't been able to find a solution to my issue with parsing Multidimensional JSON Arrays. Specifically, I am trying to extract data from the "countdown" tag, but my code only goes a ...

"Preventing scrolling in Safari with CSS overflow:hidden isn't working as expected

Why does overflow: hidden on the body tag not disable scrolling on the page in Safari? It works in Chrome but not in Safari. I'm struggling to find a solution. Can anyone help? ...

How can I stack two appbar components from Material Ui on top of each other without the vertical line separating them?

I am facing a challenge while trying to incorporate two AppBar components in Material-UI, stacked one on top of the other. The problem arises when a line appears at the end of the first AppBar, overlapping with the second one. Click here to view an image ...

Creating a List with Sublists that are displayed when hovering over the parent List is a key element of effective design

Hovering over 'View Rows' should open up both New Records and Old Records <div> <li>Add Rows</li> <li>DeleteRows</li> <li>View Rows <ul> <li>View New Records</li ...

The hidden field in php is correctly configured, but when attempting to retrieve the value using jquery, it returns as 'undefined'

I am facing an issue with a javascript file that is sending data to php files to retrieve data from a mysql database and then populate fields with the retrieved data. The problem arises when I call the php function to store the field names in the database; ...

Utilizing Google Chrome Developer Tools for JQuery console debugging

Just started using jQuery and was expecting to see [<li>my name</li>, in the Google Chrome console but got: [li, prevObject: r.fn.init(1)] 0 : li length : 1 prevObject : r.fn.init(1) proto : Object(0) <html> ...

button bouncing effect when scrolling vertically

Is there a way to create an element that bounces based on the user's scroll direction? For instance, if the user scrolls down, the button should bounce from bottom to top, and if scrolling up, the button should bounce from top to bottom. I have been ...

Is it possible to embed a Microsoft Teams meeting within an Iframe?

Is it possible for MS Teams to provide a URL of a video meeting that can be embedded in external locations, such as an iframe on my website? I attempted to add it like this: <iframe src="https://teams.microsoft.com/l/meetup-join/19%3ameeting_N2E3M ...

Ways to retrieve the chosen value from a dropdown list using the Select element

How to retrieve the value of a selected option in a dropdown menu using jQuery <select> <option value="100">apple</option> <option value="263">banana</option> <option value="500">orange</option&g ...

Get the value from a PHP JSON object using jQuery

During my PHP coding, I have a process in place where I generate a dynamic list of values and convert them into JSON format using json_encode. The code snippet for this operation is shown below: <?php $posts = get_post_meta(get_the_id(), 'size_re ...