Total Page Preview: 000000000366
What is fadeIn() and fadeOut() in JQuery?
fadeIn() and fadeOut()
In jQuery, fadeIn() and fadeOut() are methods used to create fade-in and fade-out effects on HTML elements. These methods manipulate the opacity of elements to gradually make them appear or disappear. Here's an explanation of each:
1-fadeIn() method:
-
The fadeIn() method is used to gradually increase the opacity of selected elements, making them visible.
-
It takes a duration parameter (in milliseconds) that determines how long the fading effect will take.
-
Optionally, you can also provide a callback function that will be executed once the fading is complete.
Example:
2-fadeOut() method:
-
The fadeOut() method is used to gradually decrease the opacity of selected elements, making them disappear.
-
Like fadeIn(), it also takes a duration parameter (in milliseconds) and an optional callback function.
Example:
In both examples, the jQuery library is included, and a simple box element is selected using the class selector (".box"). The fadeIn() and fadeOut() methods are applied with a duration of 2000 milliseconds (2 seconds). After the fading effect is complete, an alert is shown with a message.
Thank You
About Author
Brijesh Kumar
Database Developer
I have more then 6 years Experience in Microsoft Technologies - SQL Server Database, ETL
Azure Cloud - Azure SQL Database, CosmosDB, Azure Data Factory, PowerBI, Web Job, Azure Function, Azure Storage, Web Apps, Powershall
and Database Migration On-Premise to Azure Cloud.
LinkedIn : https://www.linkedin.com