Open In App

jQuery UI Resizable create Events

Last Updated : 07 Feb, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

jQuery UI consists of GUI widgets, visual effects, and themes implemented using HTML, CSS, and jQuery. jQuery UI is great for building UI interfaces for the webpages. The jQuery UI Resizable create event is triggered when the resizable is created.

Syntax:

Initializing the resizable create event.

$( ".selector" ).resizable({
 create: function( event, ui ) {}
});
  • Binding an event listener to the resizecreate event.

    $( ".selector" ).on( "resizecreate", function( event, ui ) {} );

Parameters: It accepts a callback function that has two parameters.

  • event: It accepts event type value.
  • ui: It accepts Object type value. The ui object can be empty but used for consistency with other events.

CDN Link: First, add jQuery UI scripts needed for your project.

<link rel=”stylesheet” href=”//code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css”>
<script src=”//code.jquery.com/jquery-1.12.4.js”></script>
<script src=”//code.jquery.com/ui/1.12.1/jquery-ui.js”></script>

Example: This example demonstrates the jQuery UI Resizable create Events.

HTML




<!doctype html>
<html lang="en">
  
<head>
    <meta charset="utf-8">
    <link rel="stylesheet" href=
"//code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css">
    <script src=
"//code.jquery.com/jquery-1.12.4.js">
    </script>
    <script src=
"//code.jquery.com/ui/1.12.1/jquery-ui.js">
    </script>
    <style>
        h1 {
            color: green;
        }
  
        #GFG {
            width: 150px;
            height: 150px;
            background: green;
            display: flex;
            justify-content: center;
            align-items: center;
            text-align: center;
        }
    </style>
</head>
  
<body>
    <center>
        <h1 style="color:green;">
            GeeksforGeeks
        </h1>
        <h3>jQuery UI Resizable create Events</h3>
        <div id="log"></div>
        <div id="GFG">GeeksforGeeks</div>
    </center>
    <script>
        $(document).ready(function () {
            $("#GFG").resizable({
                maxWidth: 300
            });
            $("#GFG").resizable({
                create: function (event, ui) { }
            });
            $("#GFG").on("resizecreate", function (event, ui) { });
            $("#log").html('Resizable has been created.');
        });
    </script>
</body>
  
</html>


Output:

jQuery UI Resizable create Events

jQuery UI Resizable create Events

Reference: https://api.jqueryui.com/resizable/#event-create



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads