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

What is the method to have VIM recognize backticks as quotes?

Currently working in TypeScript, I am hoping to utilize commands such as ciq for modifying the inner content of a template literal. However, it appears that the q component of the command only recognizes single and double quotation marks as acceptable ch ...

Begin composing in Excel

I am looking to manipulate an existing Excel file by writing values from an array and closing it all on the client side. Here is the code snippet I have been using: for (var c=0; c<arrMCN.length; c++) { var mcnCreate = arrMCN[c]; var mcnNumber =mcnCre ...

Is it possible to use a webcam to scan a QR code directly into a webpage?

Is it possible to enable users to input data on a webpage using QR code scanning? I'm unsure if there is a tool that can be integrated into the page or paired with a library to make this happen, or if I need to consider an external solution beyond th ...

Monitor the collection for changes before adding an item to the collection

When using ui-select multiple, I am facing an issue where I need to check the collection before ng-model="collection" is updated in order to ensure that the new value is not already present in it. Simply watching the collection does not solve this problem ...

Creating a div larger in size than the wrapper

Would it be feasible to have a container with a width of 1000px;, while simultaneously having a DIV inside the container that has a width of 100%? Is that achievable in any way? Here is a snippet of my code: <div class="block1"> <img src="i ...

Sending data from an AJAX request to a Spring controller is a common task in web

var TableDatatablesEditable = function () { var handleTable = function () { function restoreRow(oTable, nRow) { var aData = oTable.fnGetData(nRow); var jqTds = $('>td', nRow); for (var i = 0, ...

Initial React render fails to retrieve API data

I've encountered an issue during development where the page loads before the API data is sent. I attempted to use asynchronous functions, but it didn't resolve the problem as expected. I suspect that my approach may be incorrect. Here's a sn ...

Quasar unable to detect vuex store

I am currently working with the Quasar framework and I am trying to add a store module. Despite running the quasar new store <name> command, I keep receiving the message "No vuex store detected" in the browser console. Any idea where the issue migh ...

Converting JSON to JS in Django results in an error: SyntaxError indicating a missing colon after the property

I'm trying to figure out how to incorporate a JSON file into a script. I've been unsuccessful in loading it from the filesystem, so I created a view that serves the JSON data directly to the page like this: def graph(request, d): ...

Checking for the presence of a specific function in a file using unit testing

I am curious if there is a possible way to utilize mocha and chai in order to test for the presence of a specific piece of code, such as a function like this: myfunction(arg1) { ...... } If the code has been implemented, then the test should return t ...

When a fresh tile is loaded in Mapbox, an event is triggered

As I work with the Mapbox GL JS API to manipulate maps, I find myself wondering if there is an event that can inform me whenever a new tile HTTP request is made. My code snippet looks like this: map.on("dataloading", e => { if(e.dataType ...

Navigating websites: Clicking buttons and analyzing content

When looking to navigate a website's directory by utilizing buttons on the page or calling the associated functions directly, what language or environment is most suitable for this task? After experimenting with Python, Java, Selenium, and JavaScript, ...

Unable to identify the element ID for the jQuery append operation

After attempting to dynamically append a textarea to a div using jQuery, I encountered an issue. Despite the code appearing to work fine, there seems to be a problem when trying to retrieve the width of the textarea using its id, as it returns null. This s ...

Using SVG as a background image on Internet Explorer with zoom capabilities

I am having an issue with my SVG used as a background image: <div class="bubble"></div> Here is the CSS I am using: .bubble { background-image: url(https://beta.creasoft.cz/Images/bubble-small.svg); background-repeat: no-repeat; width ...

Indicate the highest value on Amcharts by drawing a line

I am currently working on plotting a graph that involves a significant amount of data. I have around 96 plots per day, and users can fetch data for up to a maximum range of 62 days. To implement this, I am utilizing Amcharts, but I have encountered an issu ...

Having trouble with Material-UI Textfield losing focus after re-rendering? Need a solution?

I am currently utilizing Material-ui Textfield to display a repeatable array object: const [sections, setSections] = useState([ { Title: "Introduction", Text: "" }, { Title: "Relationship", ...

Issue encountered while attempting to log out a user using Keycloak in a React JS application

I'm currently working on implementing authentication for a React JS app using Keycloak. To manage the global states, specifically keycloackValue and authenticated in KeycloackContext, I have opted to use React Context. Specific Cases: Upon initial r ...

Utilizing the NestJS Reflector within a Custom Decorator: A Comprehensive Guide

I have implemented a solution where I use @SetMetaData('version', 'v2') to specify the version for an HTTP method in a controller. Additionally, I created a custom @Get() decorator that appends the version as a suffix to the controller ...

What is the best way to align the logo image in the center of the header vertically?

I am trying to vertically center my logo, but I have not been successful with using margin: auto or margin: center. Here is what I have tried so far: ・text-align: center; ・margin: auto; ・margin: center: ・navbar-brand-center The logo currently app ...

Using React in ES5 to create a button that triggers two separate functions with a

I have encountered an issue with two React classes that both contain a render function returning forms with buttons. In class A, I had to import class B in order to use the form from class B. The problem: Whenever I click the inner button, the outer butto ...