Using CSS3 animation when adding a class, rather than on page load

I am trying to trigger my keyframe animations when the .show class for the popup window is added through JS, but currently the animation only activates upon page load.

This is the JavaScript code I have:

<script type="text/javascript"> 
$(document).ready(function() {
    $("#showSimpleModal").click(function() {
        $("div#simpleModal").addClass("show");
        return false;
    });

    $("#closemodal").click(function() {
        $("div#simpleModal").removeClass("show");
        return false;
    });
});
</script> 

My CSS Styles:

@-webkit-keyframes editwindow { 
    0% { -webkit-transform: scale3d(2.5, 2.5, 1); opacity: 0; }
    100% { -webkit-transform: scale3d(1, 1, 1) }
}

div#simpleModal {
    position: absolute;
    top:25%;
    left:25%;
    width: 560px;
    padding: 2px;
    background: #495263;
    -webkit-border-radius: 6px;
    -moz-border-radius: 6px;
    border-radius: 6px;
    border: solid 1px #2b323a;
    -moz-box-shadow: 0 0 35px rgba(0, 0, 0, 1), 0 1px rgba(255, 255, 255, .15) inset;
    -webkit-box-shadow: 0 0 35px rgba(0, 0, 0, 1), 0 1px rgba(255, 255, 255, .15) inset;
    box-shadow: 0 0 35px rgba(0, 0, 0, 1), 0 1px rgba(255, 255, 255, .15) inset;
    opacity: 0;
    z-index: 0;
}
div#simpleModal.show {
    opacity: 1.0;
    z-index: 100;
    -webkit-animation-name: editwindow;
    -webkit-transition: all 0.2s ease-in-out;
    -moz-animation-duration: 400ms;
    -moz-animation-name: pop;
    -moz-animation-timing-function: ease-in-out;
}

Is there a way to ensure that the animation is triggered when the show class is added?

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

Create a JavaScript function without attaching it to the global window object

Can someone please help me with defining a function and using it inside Jquery within the $(document).ready block? function addLeadingZero(number) { return (number < 10 ? '0' : '') + number } I'm not confident that I ha ...

The color of the left arrow on the tooltip cannot be altered

Currently, I am using a tooltip that is positioned on the right side: <i class="fas fa-question-circle text-blue" data-toggle="tooltip" data-placement="right" title="hello" ></i> I have attempted to modify the color of the too ...

The CSS styling for changing the background-color and color of list items (li) is

Trying to customize the background-color and color of li, but despite inspecting it, the changes are not reflecting on the page. Does anyone know why this is happening and how to fix it? Update: Here's a link to the JSFiddle. However, when I run it ...

Displaying a Progress Bar while Inserting Data into a Database Using Asp.net

When I click on the insert/update button, I want to display a progress bar. However, due to some validations, updations, and insertion functions in the buttons, I am unable to calculate the time taken for a particular button click process. The following ...

Steps for closing an Android dialog opened by an HTML select tag

I'm in the process of developing a mobile web application for both Android and iPhone. Currently, my HTML page includes a select tag that, when selected on an Android browser, triggers the default spinner dialog with options like Previous, Next, and D ...

row-1 css classes on the top in a project built with Blazor

I'm currently working on customizing the standard layout provided in Blazor projects like WASM or server, but I'm a bit perplexed by the top-row px-4 css classes. Within the HTML code that appears to define the top row/header section is this sni ...

Discovering the Nearest Textfield Value Upon Checkbox Selection Using JQuery

How can I retrieve the value of the nearest Textfield after selecting a checkbox? This HTML snippet serves as a simple example. In my actual project, I have dynamically generated lists with multiple checkboxes. I require a way to associate each checkbox wi ...

The functionality of a JQuery post within a PHP loop is not functioning optimally

I am encountering an issue with my list.php file, which generates a list with items and a button (Erledigt!) that triggers a jQuery Post to wishdelete2.php. The problem is that the jQuery post sometimes requires multiple clicks (3x or 5x) before it process ...

Using AJAX to submit a single form

Within my HTML view, I have multiple forms that are displayed using a PHP foreach loop. One of the form examples is as follows: <form method="POST" class="like-form-js"> <input type="hidden" name="post_id" value="<?= $post['i ...

Insert text into the cursor location within Summernote using JQuery

Currently, I am working on a flutter application where I have implemented the summernote editor using JQuery. ClipboardData data = await Clipboard.getData(Clipboard.kTextPlain); String txtIsi = data.text .replaceAll("'", '\&bsol ...

Ajax Loading Bar similar to YouTube is not functioning as expected

I've implemented the YouTube-like Ajax Loading Bar to load a PHP file. Here is the JavaScript code I'm using: $(".ajax-call").loadingbar({ target: "#loadingbar-frame", replaceURL: false, direction: "right", async: true, complete: fun ...

What is the best way to display a selected checkbox in an AJAX editing modal?

Can someone assist me in loading the checked checkboxes in an edit modal? I am using checkboxes to assign multiple roles in my system. Everything was working fine, but I encountered an issue with my edit modal where the checkboxes appear blank and unchecke ...

where should the arguments for the postMessage command be directed within the YouTube iframe?

Apologies if it seems like I'm reposting a similar issue, but this is actually a different problem with a unique approach. Currently, I have an iframe element: <iframe id="video1" width="970" height="546" src="https://youtube.com/embed/9IYRC7g2IC ...

Issues with SocketIO message reception in JavaScript

My current project involves setting up a FlaskSocketIO with socket.io.js application to facilitate real-time communication between the frontend and my web socket server. Here is a snippet of the frontend code: $(document).ready(function() { name ...

Is it just me or does my wrapper always hover above the bottom of the screen?

I have been working on coding a simple layout that I created last year. Most of the work is done, but I ran into an issue where the 'wrapper' div doesn't extend to the bottom of the page as expected. It almost looks like it has the "position ...

What is the solution for fixing scrolling while keeping the header fixed and ensuring that the widths of headers and cells are equal?

Is there a way to set a minimum width for headers in a table and provide a scroll option if the total width exceeds 100% of the table width? Additionally, how can we ensure that the width of the header and td elements are equal? Below is the HTML code: ht ...

Trouble with placing an absolutely positioned element using Tailwindcss

I am currently working on a project using TailwindCSS in which I have a logo positioned to the left and navigation to the right. Both elements are centered, but because the logo has a position of absolute, it appears in front of the navigation. I would lik ...

"Upon successful completion of a jQuery AJAX POST request, data is

Could you help me troubleshoot my code? I can't seem to retrieve my data. Thank you. Index.php <script type="text/javascript> jQuery(document).ready(function(){ $(".click").click(function(){ var value = $(this).val();// sendin ...

The jQuery toggle menu seems to be malfunctioning

I am experiencing an issue with a menu on my website. The menu can be viewed here: http://jsfiddle.net/paTNz/2/ The problem occurs when I try to click directly under the word "English" - the menu suddenly closes. This is confusing to me because the event ...

Fixed position not being maintained after clicking the button

Looking for some help with a fixed header issue on my website. The header is supposed to stay at the top while scrolling, which works well. However, when I switch to responsive view, click the menu button, and then go back to desktop view, none of the po ...