This article shares the specific code of JQuery to achieve hiding and displaying animation effects for your reference. The specific content is as follows Hide and Showgrammar
Parameter Description: The optional speed parameter specifies the speed of hiding/showing and can take the following values: "slow", "fast" or milliseconds. Implementation Code <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Document Processing</title> <script type="text/javascript" src="js/jquery-1.11.1.js"></script> <style> div { background: lightblue; padding: 20px; } p { background: lavenderblush; padding: 20px; } </style> <script> $(function() { $("#btnHide").click(function() { //$("div").hide(); //$("div").hide(2000); $("div").hide(2000, function() { alert("Hiding completed!"); }); }); $("#btnShow").click(function() { //$("div").show(); //$("div").show(2000); $("div").show(2000, function() { alert("Display completed!"); }); }); $("#btnToggle").click(function() { //$("p").toggle(); //$("p").toggle(2000); $("p").toggle(2000, function() { alert("Switch completed!"); }); }); }); </script> </head> <body> <button id="btnHide">Hide-div</button> <button id="btnShow">Show-div</button> <button id="btnToggle">Switch show and hide -p</button> <div>div1</div> <br/> <div>div2</div> <p style="display: none;">p1</p> <p>p2</p> </body> </html> Effect display Hide effect display Display effect display Toggle show and hide Switched from P1 to P2 Fade in and fade outgrammar
Parameter Description: The optional speed parameter specifies the speed of hiding/showing and can take the following values: "slow", "fast" or milliseconds. Implementation Code <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Effect</title> <script type="text/javascript" src="js/jquery-1.11.1.js"></script> <style> div { background: lightblue; padding: 20px; } p { background: lavenderblush; padding: 20px; } </style> <script> $(function() { $("#btnIn").click(function() { //$("div").fadeIn(); //$("div").fadeIn(2000); $("div").fadeIn(2000, function() { alert("Fade in completed!"); }); }); $("#btnOut").click(function() { //$("div").fadeOut(); //$("div").fadeOut(2000); $("div").fadeOut(2000, function() { alert("Fade out completed!"); }); }); $("#btnToggle").click(function() { //$("p").fadeToggle(); //$("p").fadeToggle(2000); $("p").fadeToggle(2000, function() { alert("Switch completed!"); }); }); }); </script> </head> <body> <button id="btnIn">Fade-in-div</button> <button id="btnOut">Fade-out-div</button> <button id="btnToggle">Toggle fade in and out - P</button> <div>div1</div> <br/> <div>div2</div> <p style="display: none;">p1</p> <p>p2</p> </body> </html> The effect is not much different from hiding and showing The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Briefly describe mysql monitoring group replication
>>: Docker solves the problem that the terminal cannot input Chinese
Preface Let’s take a look at the final effect fir...
This article shares the installation and configur...
Table of contents 1. Tool Introduction 2. Workflo...
This article shares the specific code of Bootstra...
The first one is to use jQuery's ajax to send...
This article example shares the specific code of ...
For individual webmasters, how to make their websi...
1. nohup Run the program in a way that ignores th...
Use "onInput(event)" to detect whether ...
Table of contents Vue3 encapsulation message prom...
Introduction to MySQL Window Functions MySQL has ...
Grid layout Attributes added to the parent elemen...
In the MySQL database, after tables are associate...
I suddenly thought of this method when I was writi...
1. Enter the host machine of the docker container...