Can .addClass () and .removeClass () add excessive animation?

the original div is fixed somewhere, when you click on the div, the div is enlarged and absolutely positioned in the middle of the screen, and it is a bit over-animated before zooming in and out!

the following code realizes click-and-pop to zoom in and out, but I don"t know how to add excessive effect, no excessive effect is too stiff.

<style>
.fd{width: 800px; height: 500px;position: fixed;top: 17%;z-index: 999;left: 25%;}
-sharptanchu{}
 </style> 
             <script>
                 var tanchu=$("-sharptanchu");
                 var guanbi=$("-sharpguanbi");
                    tanchu.click(function(){
                     if(!$(tanchu).hasClass("fd")){
                         tanchu.addClass("fd"); 
                       } 
                    });
                    guanbi.click(function(){
                      if(!$(tanchu).hasClass("fd")){  
                      }else{
                        tanchu.removeClass("fd");
                      }
                     event.stopPropagation();
                  })
                 
             </script>

can excessive animation be added to methods like the above?

Aug.05,2021

css:
add a transition: all 1s;

.fd{width: 800px; height: 500px;position: fixed;top: 17%;z-index: 999;left: 25%; transition: all 1s;}

if compatibility is not required, you can directly use transition in css, and animate


if you have compatibility requirements.

if you don't want to change too much to reference a jqueryui, you can add an extra transition time parameter

<script src="https://unpkg.com/jqueryui@1.11.1/jquery-ui.js"></script>
<style>
.fd{width: 800px; height: 500px;position: fixed;top: 17%;z-index: 999;left: 25%;}
-sharptanchu{}
 </style> 
             <script>
                 var tanchu=$("-sharptanchu");
                 var guanbi=$("-sharpguanbi");
                    tanchu.click(function(){
                     if(!$(tanchu).hasClass("fd")){
                         tanchu.addClass("fd",1000); 
                       } 
                    });
                    guanbi.click(function(){
                      if(!$(tanchu).hasClass("fd")){  
                      }else{
                        tanchu.removeClass("fd",1000);
                      }
                     event.stopPropagation();
                  })
                 
             </script>
Menu