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
Supervisor is a very good daemon management tool....
Recorded the installation of mysql-8.0.12-winx64 ...
Operating system win10 MySQL is the 64-bit zip de...
Scenario: The data in a table needs to be synchro...
introduce This chapter mainly introduces the proc...
The <script> tag In HTML5, script has the f...
This article describes the Linux file management ...
Table of contents Preface 1. scp usage 2. Use sft...
Table of contents Cross-domain reasons JSONP Ngin...
The Internet is already saturated with articles o...
Let's first look at the MySQL official docume...
vue scaffolding -> vue.cli Quickly create a la...
background Some time ago, our project team was he...
Table of contents Preface Lua Script nignx.conf c...
The container has already been created, how to kn...