Skip to content
Related Articles

Related Articles

jQuery UI Fade Effect

View Discussion
Improve Article
Save Article
Like Article
  • Last Updated : 19 Jan, 2021

In this article, we are going to show the effect of fade using jQueryUI, all the content will fade out when the action button is clicked which actually triggers the fade effect script.


$( ".selector" ).effect( 
    selectedEffect, options, time(in ms), callback 


  • selectedEffect: Effect selected given in jQueryUI.
  • options: Added for certain functionality (optional).
  • time: time to complete the effect in microseconds.
  • callback: Added for certain functionality (optional).

Return Value: It does not return any value.

Scripts added:

Please download the library for including pre-compiled files or use the path for the given script below.

<link rel=”stylesheet” href=”//”>

<script src=””></script>

<script src=””></script>

Example: In this example, we are going to show the fade effect using jQueryUI. We will trigger the script using a button.


<!doctype html>
<html lang="en">
    <meta charset="utf-8">
    <meta name="viewport" content=
        "width=device-width, initial-scale=1">
    <link rel="stylesheet" href=
    <script src=
    <script src=
        $(function() {
            function action(selectedEffect) {
                $("#effect").effect(selectedEffect, 1200);
            $("#button").on("click", function() {
                return false;
        .animation {
            width: 500px;
            height: 500px;
            position: absolute;
        #button {
            padding: .5em 1em;
            text-decoration: none;
            position: absolute;
        #effect {
            width: 250px;
            height: 190px;
            padding: 15px;
            position: relative;
        Geeks for Geeks Fade 
        Effect Using jQuery UI
    <div class="animation">
        <div id="effect" class=
            "ui-widget-content ui-corner-all">
            <h3 class="ui-widget-header 
                ui-corner-all" style=
                    "margin: 0; padding: 0.4em; 
                    height: 170px; text-align: center;
                    background-color: green;">
                Geeks For Geeks
    <span style="margin-left: 6em;">
          <button id="button" class=
            "ui-state-default ui-corner-all"
                  style="margin-top: 18em;">


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!