javascript - changing content of modal and resizing window with animation -


I have a model in which I am showing a form, when I submit the form, I want to hide the contents of the form And instead, some AJAX indicator of fixed size would show 100px x 100px. The problem is how to reduce the width / height of the model to 10000100 with some animation and this model remains remaining inside the center of the screen?

  & lt; Div class = "modal" & gt; & Lt; Form & gt; .... & lt; / Form & gt; & Lt; div class = "Ajax-indicator hidden" & gt; & Lt; / Div & gt; & Lt; / Div & gt;   

after clicking the submit button

  & lt; Div class = "modal" & gt; & Lt; Form class = "hidden" & gt; .... & lt; / Form & gt; & Lt; Div class = "ajax-indicator" & gt; & Lt; / Div & gt; & Lt; / Div & gt;    

Create multiple steps (CSS class) & amp; You can activate with js events.

You can only get your animation such as some event handlers like:

  click, transitionend, submit ...   

And then just change the correspondent square.

CSS

  # box {status: fixed; Width: 0px; Height: 0px; Top: 0%; Left: 0%; Background color: black; margin-left: 0px; Margin top: 0px; -Widk-Infection: All 700 MMS Easy; Hidden flurry; Border-Radius: 0px; } # Box. Active {width: 300px; Height: 300px; Top: 50%; Left: 50%; Margin top: -150px; Margin-left: -150px; Border-Radius: 0px; } # Box. Loading {width: 100px; Height: 100px; Top: 50%; Left: 50%; Margin top: -50px; margin-left: -50px; Border-radius: 100px; }   

JS

In this example, I am using a code of time with the code type setTimeout Which remains for 2 seconds Submit after clicking on BTN

  function clk (e) {box.classList.add ('active'); } Function frm (e) {e.preventDefault (); box.classList.remove ('active'); box.classList.add ('Loading'); setTimeout (function () {box.classList.remove ('Loading')}, 2000); } var BTN = document.getElementById ('BTN'), box = document.getElementById ('box'); btn.addEventListener (clk 'click', false); box.firstChild.addEventListener ('presented', frm, false); //box.addEventListener ('webkittransitionend',dosomethingelse,false);   

Demo

This example uses advanced technologies that work on all browsers. .. Chrome, Firefox ie10 Opera iOS Android ...

Maybe you have a custom code like -webkit -moz -o ...

There is another example that will eventually use the delay witch to hide the window completely.



Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -