Discover the Magic of CSS Animation

I am not experienced in CSS animations and have limited knowledge about animations. I am trying to create an animation where a grey box slides down from the top line above the login/register section, but currently it only fades in. If anyone can provide any assistance, I would greatly appreciate it. Please test the code in your browser to see how it functions properly. P.S. The animation should trigger when the button is clicked.

If anyone can help with this, I would be very grateful.

var regbutton = document.getElementById('Register_Button');

var regpopup = document.getElementById('cover_for_register');

regbutton.onclick = function () {
    "use strict";
    regpopup.style.display = "block";
}
body{
    margin: 0px auto;
}
button, input, p, h1, h2, h3, h4, h5, a{       /* State that these particular elements be "fantasy" */
    font-family: Tahoma;
}
#home_container{
    margin: 0px auto;
}
#home_left_section{
    float: left;
    height: 100%;
    width: 55%;
    background:-webkit-linear-gradient(#2aefff, #ffffff);
}
#home_right_section{
    float: right;
    height: 100%!important;
    width: 45%;
    box-shadow: 0px 0px 14px #888;
    z-index: 10000;
    background-color:aliceblue;
}
#home_right_section h1{
    padding-bottom: 25px;
    padding-top: 25px;
    font-size: 60px;
    margin: 0px;
    text-align: center;
}
#home_right_section h2{
    margin: 0px;
}
#home_right_section hr {
    margin: 0px;
}
#login_register_container{
    display:inline-block;
    width: 100%;
}
#login_container{
    text-align: center;               /* If border is created, width must be changed */
    float: left;
    padding-right:50px;
    padding-left: 30px;
    padding-top: 20px;
    margin-right: 0px auto;
    background-color: aqua;
}
.login_input_fields{
    border-radius:5px;
    width: 200px;
    padding: 5px;
    border: 1px solid #bfbfbf;
    font-size: 15px;
}
.register_popup_foot{
    
}
#register_container{
    width: 50%;
    float: right;
    margin: 0px auto;
    text-align:left;
}
#cover_for_register{
    display: none;
    position:fixed;
    height: 52%;
    width: 100%;
    background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
    -webkit-animation-name: animateone;
    -webkit-animation-duration: 1s;
}
@-webkit-keyframes animateone {
    from {min-height:200px; opacity:0}
}
#Register_Button{
    z-index: 10000;
    background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
    width:100px;
    height: 50px;
    color: white;
    text-align: center;
    margin-top: 80px;
    -moz-border-radius-bottomright: 10px;
border-bottom-right-radius: 10px;
-moz-border-radius-bottomleft: 10px;
border-bottom-left-radius: 10px;
    -moz-border-radius-topright: 10px;
border-top-right-radius: 10px;
-moz-border-radius-topleft: 10px;
border-top-left-radius: 10px;
}
#Register_Button_Container{
    width: 50%;
    float: right;
    margin: 0px auto;
    text-align:center;
    background-color: aqua;
    height: 217px;
}
<html>
<body>
<head>
<title>Home</title>
<link rel="stylesheet" href="PTrainMeCSS.css">
<meta name="viewpoint" content="width=deive-width" />
<script type="text/javascript" src="PTrainMeJavascript.js"></script>
</head>
    <div id="home_container">
        <section id="home_left_section">
            <h1></h1>
        </section>
        <section id="home_right_section">
            <h1>GetFit</h1>
            <hr />
            <h3 id="welcome_text">Here you can find whatever service you may want throughout the fitness industry</h3>
            <hr />
            <div id="login_register_container">
                <section id="login_container">
                            <h2>Login</h2>
                            <form>
                                <br />
                                    <input class="login_input_fields" type="text" name="Username" maxlength="10" placeholder="Username / E-Mail" /><br /><br />
                                    <input class="login_input_fields" type="password" name="Password" maxlength="20" placeholder="Password" />
                                    <br />
                                    <br />
                                <input type="submit" value="Login" />
                            </form>
                                <footer class="register_popup_foot">
                                    <a class="register_loginform_foot_text" href="Forgot Password.html">Reset Password</a>
                                    <br />
                                </footer>
                </section>
                <div id="Register_Button_Container">
                <section>
                    <button id="Register_Button">Register</button>
                </section>
                </div>
                <div id="cover_for_register">
                <section id="register_container">
                    <h2>Register</h2>
                    <form>
                        <br />
                            <input class="login_input_fields" type="text" name="Username" maxlength="10" placeholder="Username"/>
                            <br /><br />
                            <input class="login_input_fields" type="text" name="E-Mail" placeholder="E-Mail"/>
                            <br /><br />
                            <input class="login_input_fields" type="password" name="Password" placeholder="Password"/>
                            <br /><br />
                            <label>Age:</label>
            <br /> <select type="option" name="Age">
            <option></option>
            <option>13</option>
            <option>14</option>
            <option>15</option>
            <option>16</option>
            <option>17</option>
            <option>18</option>
            </select><br /><br />
                            Security Question: <br /><select type="select" name="Security Question">
            <option>Please select one.</option>
            <option>What was my school teachers first name?</option>
            <option>Whats my favourite chip flavour?</option>
            <option>What type was my first car?</option>
            <option>What was the name of my first school?</option>
            <option>What are my parents names?</option>
            <option>How many siblings do i have?</option>
            <option>What was the address of my first house?</option>
            </select><br /> <br />
            Answer: <br /> <input type="text" name="Answer">
            <a href="">Why</a><br /><br />
            <input type="submit" value="Submit">
                    </form>
                </section>
                </div>
            </div>
        </section>
    </div>
    <script type="text/javascript" src="PTrainMeJavascript.js"></script>
</body>
</html>

Answer №1

Looking for a quick fix?

Simply set #cover_for_register to have the highest z-index compared to other elements and modify your animation code like this:

@-webkit-keyframes animateone {
from { top:-52%;}

to {top: 5%;}//adjust as needed to cover your login page properly.

 }

These changes should resolve the issue.

Answer №2

The only thing that needs to be modified is:

@-webkit-keyframes animateone {
    from { height:0%;}
    to {height: 100%;}
 }

Additionally, include the following in the CSS...

insert top:0; position:absolute; into #cover_for_register

add position:relative; to #login_register_container

Take a look here: https://jsfiddle.net/dkrvl2011/se93orog/10/show/

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

UI and `setState` out of sync

Creating a website with forum-like features, where different forums are displayed using Next.js and include a pagination button for navigating to the next page. Current implementation involves querying data using getServerSideProps on initial page load, f ...

Ways to avoid grid items from overlapping with continuous text

import React from 'react'; import './style.css'; import Container from '@mui/material/Container'; //import Grid from '@mui/material/Unstable_Grid2'; // Grid version 2 import Grid from '@mui/material/Grid'; ...

Building a table from JSON using only JavaScript.orGenerate a

I am working with a dynamic Json containing multiple keys that may vary. Here is an example: Var children = [{num = 6, name = me, phone = 7}, {num = 8, name = him, phone = 9}] My goal is to create a table with the headers (num, name, phone) Is there a w ...

Switching FontAwesome Stacks on Hover

I'm facing a challenge with creating a quick animation that replaces an entire span on hover. How can I successfully approach replacing a span on hover? <h1>I am looking to have this element replaced...</h1> <span class="fa-stack fa-lg ...

The dependency graph of npm modules shows significant differences

I've been exploring the capabilities of the npm-remote-ls package to analyze dependency trees for modules. This tool is installed globally on my system. When I execute Command 1: npm-remote-ls object-assign The tree structure displayed is as follows ...

What is the best method to handle errors when retrieving JSON data and updating it using fetch()?

I need to figure out a way for the setMessage not to appear when encountering a PUT ERROR 404 not found in the updateTemplate function. I attempted using catch(err) but was unsuccessful. Here is the complete code snippet: My unique version of the code... ...

Guide on integrating React with Node.js and HTML

I've tried various methods, searched on Google, and checked the official site, but nothing seems to work. The code only functions properly when I include it in the HTML file of node.js like this: <!DOCTYPE html> <html lang="en"& ...

Creating a flexible image layout within a container with relative positioning

I attempted to create a basic slideshow with images sliding from right to left as an animation: let slides = document.querySelectorAll('.img-container'); let l = slides.length; let i = 0; setInterval(function(){ i = (i + 1) % l; if(i == 0){ f ...

Accessing the media player of your system while developing a VSCode extension using a nodejs backend: A comprehensive guide

I am currently utilizing the play-sound library in my project. I have experimented with two different code snippets, each resulting in a unique outcome, none of which are successful. When I implement const player = require('play-sound')({player: ...

What is preventing me from retrieving an ID value within an IF condition?

I'm trying to create a script that only allows devices with matching IP addresses, but I'm having trouble using an if statement. Whenever I include x.id inside the statement, it doesn't seem to work... any suggestions? <html> <sc ...

The display and concealment of a div will shift positions based on the sequence in which its associated buttons are clicked

I am in need of assistance with coding (I am still learning, so please excuse any syntax errors). What I am trying to achieve is having two buttons (button A and button B) that can toggle the visibility of their respective divs (div A and div B), which sh ...

Angular method $http.get is failing to function as intended

This is the HTML and JavaScript code I have written. <!DOCTYPE html> <html ng-app> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title></title> <meta name ...

The drop-down menu seems to have disappeared from sight

I'm having an issue with getting a dropdown to appear in my registration form. Everything else in the form is displaying correctly and functioning properly, but the dropdown remains invisible. After searching extensively, I haven't been able to ...

utilizing the removeClass method to toggle the visibility of a div by removing the "hidden" class

I am currently developing a dynamic game utilizing HTML, CSS, and jQuery. In the lower right corner of the screen, there is a question mark (which is an image file, not text). My objective is to display a help box when the question mark is clicked and held ...

Can you explain the contrast between window.performance and PerformanceObserver?

As I delve into exploring the performance APIs, I have come across window.performance and PerformanceObserver. These two functionalities seem to serve similar purposes. For instance, if I need to obtain the FCP time, I can retrieve it from performance.getE ...

Is there a way to convert a URL into a clickable link and retrieve the YouTube code embedded within

I have retrieved a string from the database using PHP and I want to echo it. Within this string, there is a YouTube link that I would like to make clickable, as well as extract the YouTube code at the end of the link. How can I achieve this? For example: ...

Encountering the error "java.lang.IndexOutOfBoundsException: Index: 1, Size: 1" while attempting to choose the second option in the dropdown menu

I need to choose the third option from a drop-down list that is enclosed in a div element. However, when I try to retrieve the items in the drop-down using Selenium, the size of the drop-down list is only showing as 1 even though there are actually 10 it ...

Retrieve GPS data source details using Angular 2

In my Angular 2 application, I am looking to access the GPS location of the device. While I am aware that I can utilize window.geolocation.watchposition() to receive updates on the GPS position, I need a way to distinguish the source of this information. ...

How can I represent non-ASCII characters in Java Script using encoding?

Imagine if ch = á the desired result is = \u00e1 however the current output = %E1 when escape(ch) is used and current output = %C3%A1 when encodeURIComponent(ch) is used I am working with an API that supports Unicode characters. ...

Perform the same actions on every element within the ul li

I'm facing an issue with my unordered list, where each list item contains a span element with an image inside. My goal is to set the background-image of each span to be the same as the image it contains, while also setting the opacity of the image to ...