Before using jQuery to complete the fade-in and fade-out effect, let's first get to know some codes:
in
Then let's put the above code into the overall code to see the effect The complete code is as follows <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Wellfancy</title> <style> div { margin: 10px; padding: 10px; width: 100px; display: none; } </style> <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script> </head> <body> <button>Fade-in effect</button> <button>Fade out effect</button> <button>Fade in and out switch</button> <button>Modify transparency</button> <div> <img src="images/1.jpg" style="width: 280px;"> </div> <script> $(function() { $("button").eq(0).click(function() { $("div").fadeIn(1000); }) $("button").eq(1).click(function() { $("div").fadeOut(1000); }) $("button").eq(2).click(function() { $("div").fadeToggle(1000); }); $("button").eq(3).click(function() { $("div").fadeTo(1000, 0.5); }); }); </script> </body> </html> 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:
|
<<: MySQL 8.0.18 stable version released! Hash Join is here as expected
>>: Detailed tutorial on migrating the home directory to a new partition under Ubuntu
Recently, during the development process, the MyS...
Mapping the mouse position or implementing drag e...
Table of contents The principle of Vue asynchrono...
Preface We all know that MySQL query uses the sel...
This article example shares the specific code of ...
This article records the installation and configu...
Recently, when I was working on my "Football...
1. Create a new rabbitmq in the /etc/init.d direc...
The HTML specification document introduces the cr...
Table of contents 1. Introduction 2. Why do we ne...
Table of contents 1. Register an account on Baidu...
<br />I have always believed that Yahoo'...
CSS adds scrolling to div and hides the scroll ba...
First, let’s take a look at the general practices...
Table of contents need: Ideas: lesson: Share the ...